This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/19937] New: [4.0 regression] Wrong loop exit
- From: "schwab at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Feb 2005 16:22:16 -0000
- Subject: [Bug c/19937] New: [4.0 regression] Wrong loop exit
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ cat loop.c
typedef __SIZE_TYPE__ size_t;
extern void abort (void);
extern size_t strlen (const char *);
extern int strncmp (const char *, const char *, size_t);
int foo (const char *name)
{
static const char *debug_sec_names [] =
{
".debug",
".gnu.linkonce.wi.",
".line",
".stab"
};
int i;
int flags = 0;
for (i = sizeof (debug_sec_names) / sizeof (debug_sec_names[0]); i--;)
if (strncmp (name, debug_sec_names[i], strlen (debug_sec_names[i])) == 0)
break;
if (i >= 0)
flags |= 0x10000;
return flags;
}
int main (void)
{
if (foo (".interp") == 0x10000)
abort ();
return 0;
}
$ gcc -O2 loop.c
$ ./a.out
Aborted
--
Summary: [4.0 regression] Wrong loop exit
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schwab at suse dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: ia64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19937