This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: alias/flow patch for PR 3783
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: alias/flow patch for PR 3783
- From: Kazu Hirata <kazu at hxi dot com>
- CC: wilson at redhat dot com
Hi,
With the patch
http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00252.html
the following code, a simplified version of gmtime.c from newlib,
generates a segfault when compiled with h8300-hms-gcc -mh -O2
(mainline).
struct dummy {
int element;
};
char *foo (const int *);
char *
bar (const int *p)
{
int tim = *p;
return foo (&tim);
}
There is a backtrace with gdb.
Program received signal SIGSEGV, Segmentation fault.
remove_edge (e=0x4018ff40) at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/flow.c:8907
8907 for (tmp = src->succ; tmp && tmp != e; tmp = tmp->succ_next)
(gdb) backtrace
#0 remove_edge (e=0x4018ff40) at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/flow.c:8907
#1 0x80e444e in purge_dead_edges (bb=0x826d590) at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/flow.c:10379
#2 0x80e4509 in purge_all_dead_edges () at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/flow.c:10402
During symbol reading, type qualifier 'volatile' ignored.
#3 0x81642e2 in rest_of_compilation (decl=0x4017bc3c)
at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/toplev.c:3273
During symbol reading, type qualifier 'volatile' ignored.
#4 0x8060116 in c_expand_body (fndecl=0x4017bc3c, nested_p=0)
at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/c-decl.c:6724
#5 0x805fee2 in finish_function (nested=0) at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/c-decl.c:6641
During symbol reading, type qualifier 'volatile' ignored.
#6 0x8049fd4 in yyparse_1 () at c-parse.y:358
#7 0x8162c33 in compile_file (name=0x8253be8 "kazu.c")
at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/toplev.c:2319
#8 0x81665bf in toplev_main (argc=4, argv=0xbffff9d4)
at /home/kazu/gnu/gcc/gcc-head/gcc/gcc/toplev.c:4928
#9 0x4003d177 in __libc_start_main (main=0x8090464 <main>, argc=4, ubp_av=0xbffff9d4,
init=0x804901c <_init>, fini=0x81d4d60 <_fini>, rtld_fini=0x4000e184 <_dl_fini>,
stack_end=0xbffff9cc) at ../sysdeps/generic/libc-start.c:129
(gdb) print e
$4 = (struct edge_def *) 0x4018ff40
(gdb) print e->src
$5 = (struct basic_block_def *) 0x0
(gdb)
What's happening at the end is accessing src->succ even though src is
NULL. I have not figured out why this happens.
One very weired thing is that removing the dummy struct definition
silences the segfault even though I don't see any connection between
the struct and the function bar.
Without reg_alias_info (q); around flow.c:7030, the segfault does not
happen, but this is pretty much the same as reversing the patch...
I would appreciate if somebody could take a look this.
Thanks,
Kazu Hirata