This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH for c++/25979 that doesn't break 16405


Jason Merrill wrote:

> 	PR c++/25979
> 	* tree.def: Elaborate on difference from MODIFY_EXPR.
> 	* doc/c-tree.texi (INIT_EXPR): Likewise.
> 	* cp/cp-gimplify.c (cp_gimplify_expr): Don't call
> 	cp_gimplify_init_expr for MODIFY_EXPRs.
> 	* cp/typeck2.c (split_nonconstant_init_1): Use INIT_EXPR.
> 	* gimplify.c (internal_get_tmp_var): Likewise.
> 	(gimplify_decl_expr, gimplify_init_ctor_eval): Likewise.
> 	(gimplify_target_expr): Likewise.
> 	(gimplify_cond_expr): Remove target handling.
> 	(gimplify_modify_expr): Don't clobber INIT_EXPR code here.
> 	(gimplify_expr): Clobber it here.
> 	(gimplify_modify_expr_rhs): Push assignment into COND_EXPR here.
> 	Do return slot optimization if we have an INIT_EXPR.
> 
> 	PR tree-opt/24365
> 	* tree-inline.c (declare_return_variable): Also clear 
> 	DECL_COMPLEX_GIMPLE_REG_P as needed in the modify_dest case.
> 
> 	PR c++/16405
> 	* gimplify.c (gimplify_modify_expr_rhs): Re-enable *& handling.
> 
> 	PR middle-end/22439
> 	* gimplify.c (gimplify_one_sizepos): Fix typo.

Something in here introduced a regression in complex handling,
causing test case failures of gcc.c-torture/compile/20000804-1.c
with -O3.  A simplified test case is

__complex__ int g (void)
{
  __complex__ int v = 1;
  return v;
}

__complex__ int f (void)
{
  __complex__ int v = 1;
  v += g ();
  return v;
}

With -O3 this results in

20000804-1.i: In function 'f':
20000804-1.i:9: internal compiler error: in find_lattice_value, at tree-complex.c:133

at

(gdb) bt
#0  fancy_abort (file=0x7a6cd4 "../../gcc-4_1/gcc/tree-complex.c", line=133, function=0x7a70e2 "find_lattice_value")
    at ../../gcc-4_1/gcc/diagnostic.c:602
#1  0x006ad2c0 in find_lattice_value (t=0x7a6cd4) at ../../gcc-4_1/gcc/tree-complex.c:133
#2  0x006ad54e in complex_visit_stmt (stmt=Variable "stmt" is not available.
) at ../../gcc-4_1/gcc/tree-complex.c:295
#3  0x004a0d8a in simulate_stmt (stmt=0x77e4f140) at ../../gcc-4_1/gcc/tree-ssa-propagate.c:301
#4  0x004a13d8 in ssa_propagate (visit_stmt=Variable "visit_stmt" is not available.
) at ../../gcc-4_1/gcc/tree-ssa-propagate.c:424
#5  0x006af948 in tree_lower_complex () at ../../gcc-4_1/gcc/tree-complex.c:1500
#6  0x0064b102 in execute_one_pass (pass=0x8030d0) at ../../gcc-4_1/gcc/passes.c:827
#7  0x0064b240 in execute_pass_list (pass=0x8030d0) at ../../gcc-4_1/gcc/passes.c:859
#8  0x0064b256 in execute_pass_list (pass=0x800778) at ../../gcc-4_1/gcc/passes.c:860
#9  0x0045eb36 in tree_rest_of_compilation (fndecl=0x77e48300) at ../../gcc-4_1/gcc/tree-optimize.c:419
#10 0x0040ae8e in c_expand_body (fndecl=0x77e48300) at ../../gcc-4_1/gcc/c-decl.c:6668
#11 0x0067e4e4 in cgraph_expand_function (node=0x77dba310) at ../../gcc-4_1/gcc/cgraphunit.c:1055
#12 0x0067ec22 in cgraph_optimize () at ../../gcc-4_1/gcc/cgraphunit.c:1121
#13 0x00410678 in c_write_global_declarations () at ../../gcc-4_1/gcc/c-decl.c:7676
#14 0x0062b026 in toplev_main (argc=Variable "argc" is not available.
) at ../../gcc-4_1/gcc/toplev.c:1004
#15 0x77eb7f94 in __libc_start_main () from /lib/tls/libc.so.6
#16 0x00402370 in _start ()
(gdb) frame 1
#1  0x006ad2c0 in find_lattice_value (t=0x7a6cd4) at ../../gcc-4_1/gcc/tree-complex.c:133
133           gcc_unreachable ();
(gdb) list
128           real = TREE_OPERAND (t, 0);
129           imag = TREE_OPERAND (t, 1);
130           break;
131
132         default:
133           gcc_unreachable ();
134         }
135
136       r = some_nonzerop (real);
137       i = some_nonzerop (imag);
(gdb) frame 2
#2  0x006ad54e in complex_visit_stmt (stmt=Variable "stmt" is not available.
) at ../../gcc-4_1/gcc/tree-complex.c:295
295           op1_l = find_lattice_value (TREE_OPERAND (rhs, 0));
(gdb) list
290           new_l = find_lattice_value (rhs);
291           break;
292
293         case PLUS_EXPR:
294         case MINUS_EXPR:
295           op1_l = find_lattice_value (TREE_OPERAND (rhs, 0));
296           op2_l = find_lattice_value (TREE_OPERAND (rhs, 1));
297
298           /* We've set up the lattice values such that IOR neatly
299              models addition.  */
(gdb) call debug_tree (rhs)
 <plus_expr 0x77e4f118
    type <complex_type 0x77e467b8
        type <integer_type 0x77db03a8 int public SI
            size <integer_cst 0x77da64a0 constant invariant 32>
            unit size <integer_cst 0x77da6160 constant invariant 4>
            align 32 symtab 0 alias set 3 precision 32 min <integer_cst 0x77da6440 -2147483648> max <integer_cst 0x77da6460
 2147483647>
            pointer_to_this <pointer_type 0x77db0ea0>>
        sizes-gimplified CSI
        size <integer_cst 0x77da6640 constant invariant 64>
        unit size <integer_cst 0x77da6660 constant invariant 8>
        align 32 symtab 0 alias set 2
        pointer_to_this <pointer_type 0x77e46a90>>

    arg 0 <var_decl 0x77dba380 D.1258 type <complex_type 0x77e467b8>
        used ignored CSI file 20000804-1.i line 11 size <integer_cst 0x77da6640 64> unit size <integer_cst 0x77da6660 8>
        align 32 context <function_decl 0x77e48300 f>
        chain <var_decl 0x77dba2a0 v type <complex_type 0x77e467b8>
            used CSI file 20000804-1.i line 10 size <integer_cst 0x77da6640 64> unit size <integer_cst 0x77da6660 8>
            align 32 context <function_decl 0x77e48300 f>>>
    arg 1 <complex_cst 0x77e4ec90 type <complex_type 0x77e467b8>
        constant invariant
        real <integer_cst 0x77da6a00 constant invariant 1>
        imag <integer_cst 0x77da69e0 constant invariant 0>>>


Looks like there's a VAR_DECL here that should have gotten an SSA name ...


Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]