public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/10125: Infinite loop caused by -O2
@ 2003-03-17 23:46 mast
  0 siblings, 0 replies; only message in thread
From: mast @ 2003-03-17 23:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10125
>Category:       optimization
>Synopsis:       Infinite loop caused by -O2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 17 23:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Martin Stjernholm
>Release:        gcc version 3.2.3 20030309 (Debian prerelease)
>Organization:
>Environment:
Linux 2.4.20, i686, libc 2.3.1
Reading specs from /usr/lib/gcc-lib/i386-linux/3.2.3/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,pascal,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
Thread model: posix
>Description:
The supplied program doesn't terminate with -O2. It works correctly without optimization, with -O and with -O3. It's a regression since gcc 2.95.4.
>How-To-Repeat:
Compile the following using "gcc -O2 bug.c". The resulting binary doesn't terminate when run.

int *foo (void) __attribute__ ((__const));
int *foo (void)
{
  static int arr[] = {1, 0};
  return arr;
}
int main()
{
  signed char *c = "\0\1";
  signed char **s = &c;
  while (foo()[**(unsigned char **)s] & 1)
    ++*s;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-17 23:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-17 23:46 optimization/10125: Infinite loop caused by -O2 mast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).