I get the following segfault with gcc 4.3 20070326 and 20070417. It works with gcc 4.2: Analyzing compilation unit Performing interprocedural optimizations <visibility> <early_local_cleanups> <inline> <static-var> <pure-const> <type-escape-var> Program received signal SIGSEGV, Segmentation fault. integer_zerop (expr=0x0) at /home/tbm/scratch/gcc/gcc/tree.c:1295 1295 STRIP_NOPS (expr); (gdb) where #0 integer_zerop (expr=0x0) at /home/tbm/scratch/gcc/gcc/tree.c:1295 #1 0x0000000000923316 in okay_pointer_operation (code=IDENTIFIER_NODE, op0=0x2b94c001cd20, op1=0x2b94bfcbeba0) at /home/tbm/scratch/gcc/gcc/ipa-type-escape.c:1471 #2 0x00000000009252fb in scan_for_refs (tp=<value optimized out>, walk_subtrees=0x7fffeb506cfc, data=<value optimized out>) at /home/tbm/scratch/gcc/gcc/ipa-type-escape.c:1544 #3 0x00000000008ca35b in walk_tree (tp=0x2b94bfffbd70, func=0x924f20 <scan_for_refs>, data=0x2b94bfeade00, pset=0xee27e0) at /home/tbm/scratch/gcc/gcc/tree.c:7978 #4 0x0000000000921bb8 in type_escape_execute () at /home/tbm/scratch/gcc/gcc/ipa-type-escape.c:1707 #5 0x000000000070b5d1 in execute_one_pass (pass=0xdff8c0) at /home/tbm/scratch/gcc/gcc/passes.c:1058 #6 0x000000000070b7e5 in execute_ipa_pass_list (pass=0xdff8c0) at /home/tbm/scratch/gcc/gcc/passes.c:1126
Created attachment 13388 [details] testcase
I should mention that you need -O2 to see this. I've confirmed the segfault on x86_64 and ia64.
Works with 4.3 20070303
Olga Golovanevsky <olga@il.ibm.com> made some changes to that part of the compiler during this period. Added to CC.
13207 return integer_zerop (int_const_binop (TRUNC_MOD_EXPR, 13208 top, bottom, 0)); (gdb) p debug_generic_expr (top) 4 $1 = void (gdb) p debug_generic_expr (bottom) 0
1469 tree size_of_op0_points_to = TYPE_SIZE_UNIT (TREE_TYPE (op0type)); and size_of_op0_points_to is a zero constant. Reduced testcase: struct polynomial { ~polynomial (); }; void spline_rep1() { new polynomial[0]; }
Subject: Bug 31617 Author: sje Date: Thu Apr 26 22:02:05 2007 New Revision: 124197 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124197 Log: PR middle-end/31617 * g++.dg/other/str_empty.C: Add expected warning. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/other/str_empty.C
The fix was submitted http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01578.html and committed to mainline 4.3.
FIXED.