#1657 0x8000000000000000LLU+ fails

closed-fixed
nobody
gcc (462)
2012-07-17
2012-07-16
RaubTieR
No

// good macro is the one working
#define SET_GOOD(pt)( pt = pt | 0x8000000000000000LL)
#define SET_FAIL(pt)( pt = pt | 0x8000000000000000LLU)

// Qt typedefs from qglobal.h
typedef long long qint64; /* 64 bit signed */
typedef unsigned long long quint64; /* 64 bit unsigned */

// suggested "u" to change from 0x35 to 0x8000000000000035
quint64 u = 0x35;
SET_FAIL(u); // "u" becomes 0 instead

// suggested "s" to change from 0x35 to 0x8000000000000035
qint64 s = 0x35;
SET_GOOD(s); // "s" becomes 0x8000000000000035

The idea is that we needed bitfield to contain some numbers and flags which are 64 bit summary, First we decided that unsigned type is better because it is likely to be the most hardware-native and sign independent. Any way after some experiments we came to the facts above and started to use signed int64 format which is ok. Never the less under MSVS compiler both macros work as designed.

We are sure this is a bug, since it not only refuses to work correctly but even spoils data (to 0 as described).
Qt 4.8.1 for Desktop - MinGW (Qt SDK)

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r
untime-libs --disable-werror --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.5.2 (GCC)

ld -v
GNU ld (GNU Binutils) 2.21.1

Discussion

  • Earnie Boyd

    Earnie Boyd - 2012-07-16
    • labels: 456608 --> gcc
    • milestone: 115768 --> 519164
     
  • Earnie Boyd

    Earnie Boyd - 2012-07-16

    And is this supposed but resolved by upgrading to version 4.7.0?

     
  • RaubTieR

    RaubTieR - 2012-07-17

    well it seems to work correctly in 4.7.0, thanks, now if only i make my Qt to work with it, i had to (find out how to) use GDB directly to see results because with Qt it now crashes, however LLU problem is solved.

     
  • Earnie Boyd

    Earnie Boyd - 2012-07-17
    • milestone: 519164 -->
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks