This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18814] New: Incorrect reinitialization of compound literal
- From: "austern at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2004 18:32:39 -0000
- Subject: [Bug c/18814] New: Incorrect reinitialization of compound literal
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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