This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/25487] New: Assertion failure in pointer analysis
- From: "dps at simpson dot demon dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Dec 2005 22:32:26 -0000
- Subject: [Bug c/25487] New: Assertion failure in pointer analysis
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The source here generates an asserion failure compiled with anything above -O0.
Changing p+1 to p seems to avoid the bug. The infinite loops are not a feature
of the original code but the uderlying problem appears to be indentical.
"screenshot"
dps@dps:~/duncan/src/foo/wlocal/build/phone/mq$ gcc --version
gcc (GCC) 4.2.0 20051217 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dps@dps:~/duncan/src/foo/wlocal/build/phone/mq$ gcc --version
gcc (GCC) 4.2.0 20051217 (experimental)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
dps@dps:~/duncan/src/foo/wlocal/build/phone/mq$ gcc -g -O2 -o /tmp/foo.o
/tmp/foo.c
/tmp/foo.c: In function 'foo':
/tmp/foo.c:32: internal compiler error: in handle_ptr_arith, at
tree-ssa-structalias.c:3188
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
foo.c is the following nonsense
---cut here---
#include <stdio.h>
typedef struct
{
int foo;
} s_foo;
static void bar(const s_foo *p,
int (*cmp)(const char *, const char *))
{
const char *pd;
int r;
pd=(const char *) (p+1); /* The p+1 is apparently critical */
while (1)
{
r=(*cmp)(pd, "2");
if (r<=0)
fputc('-', stdout);
else
fputc('+', stdout);
}
return;
}
void foo(int (*cmp)(const char *, const char *))
{
s_foo a;
while(1)
{
bar(&a, cmp);
}
}
---cut here---
--
Summary: Assertion failure in pointer analysis
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dps at simpson dot demon dot co dot uk
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25487