https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85252
Bug ID: 85252 Summary: Segmentation fault with -g for static zero-length array initialization Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: themos.tsikas at gmail dot com Target Milestone: --- A one-liner source provokes Segmentation fault (you can see the source line in the message below). Bug shows up in 4.x 5.x 6.x 7.x series of compilers. $ /opt/gcc-7/bin/gcc -c -g bug.c bug.c: In function ‘xxx’: bug.c:1:1: internal compiler error: Segmentation fault void xxx(){static char a[0] = ""; return;} ^~~~ 0xa0d9ff crash_signal /scratch/themos/pi/gcc-7-src/gcc/toplev.c:337 0xc18940 tree_int_cst_sgn(tree_node const*) /scratch/themos/pi/gcc-7-src/gcc/tree.c:7373 0xc19e8b compare_tree_int(tree_node const*, unsigned long) /scratch/themos/pi/gcc-7-src/gcc/tree.c:7583 0x71d59d rtl_for_decl_init /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:18740 0x71d781 rtl_for_decl_location /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:19013 0x753759 add_location_or_const_value_attribute /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:19134 0x7547f2 gen_variable_die /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:22941 0x73ce2b gen_decl_die /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:25398 0x7400e8 process_scope_var /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:24870 0x7402bf decls_for_scope /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:24895 0x740a87 gen_subprogram_die /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:22452 0x73cd28 gen_decl_die /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:25331 0x73d9de dwarf2out_decl /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:25840 0x73ddfe dwarf2out_function_decl /scratch/themos/pi/gcc-7-src/gcc/dwarf2out.c:25855 0x7a36fa rest_of_handle_final /scratch/themos/pi/gcc-7-src/gcc/final.c:4520 0x7a36fa execute /scratch/themos/pi/gcc-7-src/gcc/final.c:4562 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.