r13417 unsigned bit-fields of width 32 should be promoted to unsigned int (csmith)
ID0000823:
**This issue was created automatically from Mantis Issue 823. Further discussion may take place here.**
---
| **Id** | **Project** | **Category** | **View** | **Due Date** | **Updated** |
| --- | --- | --- | --- | --- | --- |
| ID0000823 | Frama-C | Kernel | public | 2011-05-12 | 2014-02-12 |
| | | | | | |
| --- | --- | --- | --- | --- | --- |
| **Reporter** | pascal | **Assigned To** | monate | **Resolution** | fixed |
| **Priority** | normal | **Severity** | minor | **Reproducibility** | always |
| **Platform** | - | **OS** | - | **OS Version** | - |
| **Product Version** | Frama-C GIT, precise the release id | **Target Version** | - | **Fixed in Version** | Frama-C Nitrogen-20111001 |
### Description :
#include <stdio.h>
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
issue