------- Comment #4 from rguenth at gcc dot gnu dot org 2007-02-21 15:12 ------- With 4.1.3 for C we have, even without optimizing
> ./xgcc -B. -o t t.c -Wall t.c: In function 'main': t.c:13: warning: format '%llx' expects type 'long long unsigned int', but argument 2 has type 'long unsigned int:33' > ./t 9 For C++ we for all optimizations get > ./t 200000009 The difference after gimplification is main () { <unnamed type> D.2220; int D.2221; struct S x; <unnamed type> z; x.a = 8589934591; D.2220 = x.a; z = D.2220 + 10; printf (&"%llx\n"[0], z); D.2221 = 0; return D.2221; } vs. int main() () { long long unsigned int D.2823; int D.2824; { struct S x; long long unsigned int z; x.a = 8589934591; D.2823 = x.a; z = D.2823 + 10; printf (&"%llx\n"[0], z); D.2824 = 0; return D.2824; } D.2824 = 0; return D.2824; } i.e. typeof(+x.a) yields a different result for C and C++. For C we leave bitfield types bigger than int alone and don't promote them. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30332