[Bug c/48124] New: likely wrong code bug
regehr at cs dot utah.edu
gcc-bugzilla@gcc.gnu.org
Mon Mar 14 20:36:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48124
Summary: likely wrong code bug
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: regehr@cs.utah.edu
[regehr@gamow ~]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r170949-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r170949-install
--program-prefix=r170949- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20110314 (experimental) (GCC)
[regehr@gamow ~]$ current-gcc -O1 small.c -o small
[regehr@gamow ~]$ ./small
g_1 = 2
[regehr@gamow ~]$ current-gcc -Os small.c -o small
[regehr@gamow ~]$ ./small
g_1 = 1
[regehr@gamow ~]$ cat small.c
struct S0 {
signed f0 : 26;
signed f1 : 16;
signed f2 : 10;
volatile signed f3 : 14;
};
static int g_1 = 1;
static struct S0 g_2 = {0,0,0,1};
int printf(const char *format, ...);
void func_1(void)
{
g_2.f3 = 0;
g_1 = 2;
}
int main (int argc, char* argv[])
{
func_1();
printf("g_1 = %d\n", g_1);
return 0;
}
More information about the Gcc-bugs
mailing list