[Bug c/18814] New: Incorrect reinitialization of compound literal
austern at apple dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 3 18:32:00 GMT 2004
According to the ISO C standard, compound literals in functions are objects with automatic storage
duration. The following test case modified such an object, so in this test case the value should be 1 the
first time through the loop and 77 the second time. Instead we see 1 the first time.
#include <stdio.h>
int main() {
int i = 0;
int* p;
top:
p = &((int) {1});
printf("%p %d\n", p, *p);
*p = 77;
if (i++ == 0) goto top;
return 0;
}
--
Summary: Incorrect reinitialization of compound literal
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: austern at apple dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin
GCC host triplet: powerpc-apple-darwin
GCC target triplet: powerpc-apple-darwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18814
More information about the Gcc-bugs
mailing list