Frama-C Bug Tracking System - Frama-C
View Issue Details
0000823Frama-CKernelpublic2011-05-12 14:292014-02-12 16:59
pascal 
monate 
normalminoralways
closedfixed 
Frama-C GIT, precise the release id 
Frama-C Nitrogen-20111001 
0000823: r13417 unsigned bit-fields of width 32 should be promoted to unsigned int (csmith)
#include struct S { unsigned f:32; } x = { 28349}; unsigned short us = 0xDC23L; main(){ int r = (x.f ^ ((short)-87)) >= us; printf("%d\n", r); return r; } gcc w.c && ./a.out 1 But: ~/ppc/bin/toplevel.opt -print w.c | grep -v preprocessing > w2.c && gcc w2.c && ./a.out 0 The front-end is correct in typing unsigned bit-fields as int most of the time, but there should be an exception for unsigned bit-fields of size 32. See http://stackoverflow.com/q/5977456/139746
No tags attached.
Issue History
2011-05-12 14:29pascalNew Issue
2011-05-12 14:30pascalStatusnew => assigned
2011-05-12 14:30pascalAssigned To => monate
2011-05-12 15:31svnCheckin
2011-05-12 15:31svnStatusassigned => resolved
2011-05-12 15:31svnResolutionopen => fixed
2011-05-12 18:56pascalNote Added: 0001877
2011-05-12 18:56pascalStatusresolved => feedback
2011-05-12 18:56pascalResolutionfixed => reopened
2011-05-12 18:56pascalNote Edited: 0001877
2011-05-12 18:57pascalStatusfeedback => confirmed
2011-05-13 15:23svnCheckin
2011-05-13 16:14monateStatusconfirmed => resolved
2011-05-13 16:14monateResolutionreopened => fixed
2011-10-10 14:13signolesFixed in Version => Frama-C Nitrogen-20111001
2011-10-10 14:14signolesStatusresolved => closed
2014-02-12 16:59monateNote Added: 0004791
2014-02-12 16:59monateStatusclosed => resolved

Notes
(0001877)
pascal   
2011-05-12 18:56   
You have forgotten "unsigned" before "bitfields which have a size equal to the size of int" in your commit message. Unfortunately, you have also forgotten to handle signed 32-bit bitfields in your patch. Try the following : Manzana:~ pascal$ ~/ppc/bin/toplevel.byte -val t.c ... [value] Values for function main: r ? {1} Manzana:~ pascal$ gcc t.c Manzana:~ pascal$ ./a.out 0 Manzana:~ pascal$ clang t.c t.c:7:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] main(){ ^ 1 warning generated. Manzana:~ pascal$ ./a.out 0 Manzana:~ pascal$ cat t.c #include struct S { signed f:32; } x = { 28349}; unsigned short us = 0xDC23L; main(){ int r = (x.f ^ ((short)-87)) >= us; printf("%d\n", r); return r; }
(0004791)
monate   
2014-02-12 16:59   
Fix committed to stable/neon branch.