[From https://bugzilla.redhat.com/show_bug.cgi?id=531385 ]
Testcase: cat > file1.c << EOF struct s1_s { int v; }; struct s1_s g1; void __attribute__((externally_visible)) func1() { struct s1_s *l1 = &g1; } EOF cat > file2.c << EOF extern struct s1_s g1; void func2() { &g1; } EOF cc -O -g -fwhole-program -combine -c file1.c file2.c Caused by SVN r152403: PR debug/41404 PR debug/41353 * cfgexpand.c (expand_debug_expr) <case STRING_CST>: Don't create CONST_STRING if STRING_CST contains embedded '\0's or doesn't end with '\0'. (expand_debug_expr) <case VAR_DECL>: For TREE_STATIC !DECL_EXTERNAL vars use DECL_RTL with resetting it back to NULL afterwards. * dwarf2out.c (same_dw_val_p): For dw_val_class_addr compare with rtx_equal_p instead of asserting it is a SYMBOL_REF. (value_format): For dw_val_class_addr only use DW_FORM_addr if the attribute type allows it, otherwise use DW_FORM_dataN. (mem_loc_descriptor): Handle CONST_STRING. (add_const_value_attribute): Handle CONST_STRING using add_AT_addr. Handle MEM with CONST_STRING address using add_AT_string. (rtl_for_decl_init): Return MEM with CONST_STRING address instead of CONST_STRING for const arrays initialized with a string literal. (resolve_one_addr, resolve_addr_in_expr, resolve_addr): New functions. (dwarf2out_finish): Call resolve_addr. * gcc.dg/guality/pr41404-1.c: New test. * gcc.dg/guality/pr41353-2.c: New test. -- Summary: ICE with -combine and debug Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: segher at kernel dot crashing dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41893