[Konsole-devel] [Bug 160137] New: CharacterColor.h != and == implementation causing alignment trap on ARM (and probably other) processors (x86 not affected)
Alessandro Briosi
tsdogs at briosix.org
Sun Mar 30 22:26:19 UTC 2008
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=160137
Summary: CharacterColor.h != and == implementation causing
alignment trap on ARM (and probably other) processors
(x86 not affected)
Product: konsole
Version: unspecified
Platform: Compiled Sources
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
AssignedTo: konsole-devel kde org
ReportedBy: tsdogs briosix org
Version: 2.0 up (using Devel)
Installed from: Compiled sources
Compiler: gcc-4.1.2 Porting konsole4 to Qtopia made me find this bug, which I think should be fixed.
OS: Linux
The current implementation of the inline bool operators != and ==
causes an alignment trap on arm cpu.
It's not memory alignment safe.
I found this porting konsole 2 to Qtopia.
Current implementation:
---------------------------------------
inline bool operator == (const CharacterColor& a, const CharacterColor& b)
{
return *reinterpret_cast<const quint32*>(&a._colorSpace) ==
*reinterpret_cast<const quint32*>(&b._colorSpace);
}
inline bool operator != (const CharacterColor& a, const CharacterColor& b)
{
return *reinterpret_cast<const quint32*>(&a._colorSpace) !=
*reinterpret_cast<const quint32*>(&b._colorSpace);
}
proposed new implementation fixing the problem and memory alignemnt safe:
-------------------------------------------------
inline bool operator == (const CharacterColor& a, const CharacterColor& b)
{
return (a._colorSpace == b._colorSpace && a._u == b._u
&& a._v == b._v && a._w == b._w);
}
inline bool operator != (const CharacterColor& a, const CharacterColor& b)
{
return (a._colorSpace != b._colorSpace || a._u != b._u
|| a._v != b._v || a._w != b._w);
}
More information about the konsole-devel
mailing list