[Bug middle-end/21103] New: segfault with -fdump-tree-generic
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Apr 19 11:05:00 GMT 2005
Compiling following code:
program chk
character*8 a
a = 'a string'
end
with gfortran and the -fdump-tree-generic induces a segfault:
Program received signal SIGSEGV, Segmentation fault.
0x0857af51 in dump_function_to_file (fn=0xb7ad6438, file=0x87ce8b8, flags=512)
at ../../../gcc/gcc/tree-cfg.c:5186
5186 if (basic_block_info)
(gdb) where
#0 0x0857af51 in dump_function_to_file (fn=0xb7ad6438, file=0x87ce8b8,
flags=512) at ../../../gcc/gcc/tree-cfg.c:5186
#1 0x084e223f in dump_function (phase=TDI_generic, fn=0xb7ad6438)
at ../../../gcc/gcc/tree-dump.c:1020
#2 0x080b420a in gfc_gimplify_function (fndecl=0xb7ad6438)
at ../../../gcc/gcc/fortran/trans-decl.c:1289
This is specific to the generic tree dump, and is solved by the following change
in gcc/tree-cfg.c, line 5186:
- if (basic_block_info)
+ if (cfun && basic_block_info)
/* Make a CFG based dump. */
else
/* Make a tree based dump. */
The segfault actually occurs because basic_block_info is a macro for
cfun->cfg->x_basic_block_info and cfun is NULL in that case.
I don't know if this patch isn't hiding something deeper, so I report everything
I found here (which is not much, sorry, but that part of the compiler is too
deep for me!).
PS: I'm not sure the component should be middle-end, please change it if need be.
--
Summary: segfault with -fdump-tree-generic
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fxcoudert at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21103
More information about the Gcc-bugs
mailing list