Bug 57737

Summary: -fopenmp + -femit-struct-debug-reduced/baseonly = internal compiler error: Segmentation fault
Product: gcc Reporter: Evgeny Gavrin <evgeny.gavrin>
Component: debugAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: critical CC: jakub
Priority: P3    
Version: 4.7.2   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:
Attachments: File to reproduce bug
preprocessed file
preprocessed file

Description Evgeny Gavrin 2013-06-27 17:27:13 UTC
Created attachment 30392 [details]
File to reproduce bug

Compilation of debug-1.c file from ./libgomp/testsuite with the following options: -g -fopenmp -O0 -gdwarf-2 -femit-struct-debug-reduced - causes segfault in the compiler.

The described bug is actual for GCC versions 4.4, 4.6, 4.7.
Works for -femit-struct-debug-reduced and -femit-struct-debug-baseonly

I've attached both problem example and preprocessed file to the report.

Console logs: 

egavrin@debian:~/dev/vd-issues/report-omp-failtest$ gcc-4.7 -g -fopenmp -O0 -gdwarf-2 -femit-struct-debug-baseonly ./debug-1.c
./debug-1.c: In function ‘f7._omp_fn.0’:
./debug-1.c:136:11: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccWoFu5C.out file, please attach this to your bugreport.

egavrin@debian:~/dev/vd-issues/report-omp-failtest$ gcc-4.7 -g -fopenmp -O0 -gdwarf-2 -femit-struct-debug-reduced ./debug-1.c
./debug-1.c: In function ‘f7._omp_fn.0’:
./debug-1.c:136:11: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccw1Cilr.out file, please attach this to your bugreport.

Host system info:
Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux
Comment 1 Evgeny Gavrin 2013-06-27 17:28:53 UTC
Created attachment 30393 [details]
preprocessed file
Comment 2 Evgeny Gavrin 2013-06-27 17:29:18 UTC
Created attachment 30394 [details]
preprocessed file
Comment 3 Evgeny Gavrin 2013-07-01 15:37:33 UTC
I've added crash log:

/cc1 debug-1.c -fopenmp -gdwarf-2 -femit-struct-debug-reduced
 f7 main
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups> <*free_inline_summary> <whole-program>Assembling functions:
 f7 main f7._omp_fn.0
debug-1.c: In function ‘f7._omp_fn.0’:
debug-1.c:133:11: internal compiler error: Segmentation fault
   #pragma omp parallel
           ^
0xe80a4c crash_signal
	/home/egavrin/dev/gcc/gcc/toplev.c:333
0x536597 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
	/home/egavrin/dev/gcc/gcc/tree.h:3909
0x85df13 should_emit_struct_debug
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:371
0x8ab513 gen_struct_or_union_type_die
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:19172
0x8acdcb gen_tagged_type_die
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:19415
0x8ada45 gen_type_die_with_usage
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:19562
0x8ad71e gen_type_die_with_usage
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:19518
0x8adcce gen_type_die
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:19601
0x8b16be gen_decl_die
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:20188
0x8a532a gen_subprogram_die
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:18063
0x8b0cfd gen_decl_die
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:20102
0x8b2b42 dwarf2out_decl(tree_node*)
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:20484
0x8b2b85 dwarf2out_function_decl
	/home/egavrin/dev/gcc/gcc/dwarf2out.c:20492
0x96c0b6 rest_of_handle_final
	/home/egavrin/dev/gcc/gcc/final.c:4393
Comment 4 Martin Liška 2017-04-18 15:14:24 UTC
I can confirmed that it used to ICE for old releases. However, 4.9.0+ works fine, as well as all active branches. Thus closing as resolved.