Article View: gnu.gcc.bug
Article #6353bug in gcc 2.7.x ?
From: Andrew Fyfe
Date: Sun, 03 Dec 1995 00:00
Date: Sun, 03 Dec 1995 00:00
29 lines
910 bytes
910 bytes
With gcc 2.7.x, the optimizer considers the pointer dereference to
be a constant, and moves the dereference outside the loop. This is
not the behaviour of 2.6.3. The code below is reduced from a much
larger program.
Andy Fyfe
bandr@best.com
static void
set(char *x)
{
*x = 'x';
}
main()
{
int i;
char x = '\0';
for (i=0; i<10; ++i) {
set(&x);
if (*(const char *)&x != 'x') {
printf("Error!\n");
exit(1);
}
}
printf("OK!\n");
exit(0);
}
Technical Details
Message-ID:
<199512040444.EAA11894@shellx.best.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,6eef9ba452537231,start X-Google-Attributes: gid113d02,public From: bandr@best.com (Andrew Fyfe) Subject: bug in gcc 2.7.x ? Date: 1995/12/03 Message-ID: <199512040444.EAA11894@shellx.best.com> X-Deja-AN: 120945681 distribution: gnu sender: daemon@cis.ohio-state.edu organization: GNUs Not Usenet newsgroups: gnu.gcc.bug