[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#458133: casting char arrays to double



The cause for this is quite easy to find, the only intresting
question about this bug is: How much luck must qt4 have had that
it did not fail flat on about every other architecture but i386?

Script started on Mon Mar 10 15:54:47 2008
$ gdb --args ./bin/qmake -prl -r projects.pro
(gdb) r
Starting program: /root/qt4-x11-4.3.4/bin/qmake -prl -r projects.pro

Program received signal SIGBUS, Bus error.
0x002f7ddc in qt_snan ()
    at /root/qt4-x11-4.3.4/src/corelib/global/qnumeric_p.h:81
81	    return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes : qt_le_snan_bytes);
Current language:  auto; currently c++
(gdb) p qt_be_snap_bytes
No symbol "qt_be_snap_bytes" in current context.
(gdb) p &qt_be_snan_bytes
$2 = (unsigned char (*)[8]) 0x3f040c
(gdb) p sizeof(double)
$3 = 8
(gdb) q
nn125:~/qt4-x11-4.3.4# grep qt_be_snan_bytes src/corelib/global/qnumeric_p.h
static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
    return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes : qt_le_snan_bytes);
$ exit
Script done on Mon Mar 10 15:56:50 2008

So it casts an char array constant to and double and is suprised that
this might have the wrong alignment. I'm really suprised it only hit
hppa.

Hochachtungsvoll,
	Bernhard R. Link



Reply to: