Bug 40505 - hppa: ICE: in expand_expr_addr_expr_1, at expr.c:6830
Summary: hppa: ICE: in expand_expr_addr_expr_1, at expr.c:6830
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-20 17:39 UTC by Kurt Roeckx
Modified: 2009-11-02 19:29 UTC (History)
3 users (show)

See Also:
Host: hppa-linux-gnu
Target: hppa-linux-gnu
Build: hppa-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2009-06-20 18:16:02


Attachments
Preproccessed file using g++ 4.3.3 (104.36 KB, application/gzip)
2009-06-20 17:41 UTC, Kurt Roeckx
Details
calls.c.d (405 bytes, text/plain)
2009-06-21 19:13 UTC, dave
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kurt Roeckx 2009-06-20 17:39:40 UTC
When compiling netgen we see the following error on hppa:
linalg/basematrix.cpp: In member function 'void ngla::S_BaseMatrix<std::complex<double>
+>::_ZTv0_n72_NK4ngla12S_BaseMatrixISt7complexIdEE12MultTransAddES2_RKNS_10BaseVectorERS4_(ngbla::Complex,
+const ngla::BaseVector&, ngla::BaseVector&) const':
linalg/basematrix.cpp:208: internal compiler error: in expand_expr_addr_expr_1, at expr.c:6830

I can reproduce this with g++ 4.1.2, 4.2.3 and 4.3.3.  I couldn't try different compiler versions yet.

I will attach a preprocessed file shortly.  The error message and preprocessed file are generated using 4.3.3.

It fails when using -O1 or higher.


Kurt
Comment 1 Kurt Roeckx 2009-06-20 17:41:47 UTC
Created attachment 18033 [details]
Preproccessed file using g++ 4.3.3
Comment 2 John David Anglin 2009-06-20 18:16:02 UTC
Also fails with head: gcc version 4.5.0 20090619 (experimental) [trunk revision 148688] (GCC).
Comment 3 John David Anglin 2009-06-20 20:42:19 UTC
Breakpoint 3, expand_expr_addr_expr_1 (exp=0x40d8a300, target=0x0, 
    tmode=SImode, modifier=EXPAND_NORMAL) at ../../gcc/gcc/expr.c:6887
6887		  gcc_assert (MEM_P (result));
(gdb) p debug_rtx (result)
(concat:DC (reg:DF 99 [ s.1575 ])
    (reg:DF 100 [ s.1575+8 ]))
$17 = void
(gdb) p debug_tree (exp)
 <var_decl 0x40d8a300 s.1575
    type <record_type 0x40dfcf50 Complex needs-constructing type_1 type_5 type_6 DC
        size <integer_cst 0x4006e7a0 constant 128>
        unit size <integer_cst 0x4006e7c0 constant 16>
        align 64 symtab 0 alias set -1 canonical type 0x40c458c0
        fields <field_decl 0x40ca3c00 _M_value type <complex_type 0x40cb8cb0 _ComplexT>
            used private nonlocal decl_3 DC file /usr/include/c++/4.3/complex line 1197 col 17 size <integer_cst 0x4006e7a0 128> unit size <integer_cst 0x4006e7c0 16>
            align 64 offset_align 64
            offset <integer_cst 0x4006e320 constant 0>
            bit offset <integer_cst 0x4006e8e0 constant 0> context <record_type 0x40c458c0 complex> chain <type_decl 0x40cb8a80 complex>> context <namespace_decl 0x4007e770 std>
        full-name "struct ngbla::Complex"
        needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=2 interface-unknown
        pointer_to_this <pointer_type 0x40e031c0> reference_to_this <reference_type 0x40e03ee0> chain <type_decl 0x40c45930 complex>>
    used DC file include/../linalg/basematrix.hpp line 107 col 16 size <integer_cst 0x4006e7a0 128> unit size <integer_cst 0x4006e7c0 16>
    align 64 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_>
    (concat:DC (reg:DF 99 [ s.1575 ])
    (reg:DF 100 [ s.1575+8 ])) chain <var_decl 0x40d8a360 D.49402>>
$18 = void

(gdb) bt
#0  expand_expr_addr_expr_1 (exp=0x40d8a300, target=0x0, tmode=SImode, 
    modifier=EXPAND_NORMAL) at ../../gcc/gcc/expr.c:6887
#1  0x00572a70 in expand_expr_addr_expr (exp=0x4057eaa0, target=0x0, 
    tmode=SImode, modifier=EXPAND_NORMAL) at ../../gcc/gcc/expr.c:6986
#2  0x005871a8 in expand_expr_real_1 (exp=0x4057eaa0, target=0x0, 
    tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0)
    at ../../gcc/gcc/expr.c:9309
#3  0x00573328 in expand_expr_real (exp=0x4057eaa0, target=0x0, 
    tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0)
    at ../../gcc/gcc/expr.c:7183
#4  0x004565b4 in expand_normal (exp=0x4057eaa0) at ../../gcc/gcc/expr.h:548
#5  0x00455cc0 in precompute_register_parameters (num_actuals=4, 
    args=0xbff03660, reg_parm_seen=0xbff03574) at ../../gcc/gcc/calls.c:677
#6  0x0045d0e0 in expand_call (exp=0x40f801c0, target=0x0, ignore=1)
    at ../../gcc/gcc/calls.c:2721
#7  0x00579b54 in expand_expr_real_1 (exp=0x40f801c0, target=0x0, 
    tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0)
    at ../../gcc/gcc/expr.c:8142
#8  0x005732f0 in expand_expr_real (exp=0x40f801c0, target=0x40073310, 
    tmode=VOIDmode, modifier=EXPAND_NORMAL, alt_rtl=0x0)
    at ../../gcc/gcc/expr.c:7177
#9  0x008e5714 in expand_expr (exp=0x40f801c0, target=0x40073310, 
    mode=VOIDmode, modifier=EXPAND_NORMAL) at ../../gcc/gcc/expr.h:542
---Type <return> to continue, or q <return> to quit---
#10 0x008e7300 in expand_expr_stmt (exp=0x40f801c0)
    at ../../gcc/gcc/stmt.c:1353
#11 0x00ca041c in expand_gimple_basic_block (bb=0x412d7090)
    at ../../gcc/gcc/cfgexpand.c:2146
#12 0x00ca2d40 in gimple_expand_cfg () at ../../gcc/gcc/cfgexpand.c:2586
#13 0x007c23ec in execute_one_pass (pass=0xf63640)
    at ../../gcc/gcc/passes.c:1289
#14 0x007c2768 in execute_pass_list (pass=0xf63640)
    at ../../gcc/gcc/passes.c:1338
#15 0x009a0654 in tree_rest_of_compilation (fndecl=0x40f59180)
    at ../../gcc/gcc/tree-optimize.c:394
#16 0x00be4170 in cgraph_expand_function (node=0x4118c100)
    at ../../gcc/gcc/cgraphunit.c:1097
#17 0x00be1910 in cgraph_process_new_functions ()
    at ../../gcc/gcc/cgraphunit.c:430
#18 0x00be43f8 in cgraph_expand_all_functions ()
    at ../../gcc/gcc/cgraphunit.c:1159
#19 0x00be4c2c in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1379
#20 0x001eb250 in cp_write_global_declarations ()
    at ../../gcc/gcc/cp/decl2.c:3642
#21 0x009079dc in compile_file () at ../../gcc/gcc/toplev.c:1036
#22 0x0090ab78 in do_compile () at ../../gcc/gcc/toplev.c:2345
#23 0x0090acc4 in toplev_main (argc=12, argv=0xbff01024)
---Type <return> to continue, or q <return> to quit---
    at ../../gcc/gcc/toplev.c:2390
#24 0x003df0b4 in main (argc=12, argv=0xbff01024) at ../../gcc/gcc/main.c:35

(gdb) frame 1
#1  0x00572a70 in expand_expr_addr_expr (exp=0x4057eaa0, target=0x0, 
    tmode=SImode, modifier=EXPAND_NORMAL) at ../../gcc/gcc/expr.c:6986
6986	  result = expand_expr_addr_expr_1 (TREE_OPERAND (exp, 0), target,
(gdb) p debug_tree (exp)
 <addr_expr 0x4057eaa0
    type <pointer_type 0x40e031c0
        type <record_type 0x40dfcf50 Complex needs-constructing type_1 type_5 type_6 DC
            size <integer_cst 0x4006e7a0 constant 128>
            unit size <integer_cst 0x4006e7c0 constant 16>
            align 64 symtab 0 alias set -1 canonical type 0x40c458c0 fields <field_decl 0x40ca3c00 _M_value> context <namespace_decl 0x4007e770 std>
            full-name "struct ngbla::Complex"
            needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=2 interface-unknown
            pointer_to_this <pointer_type 0x40e031c0> reference_to_this <reference_type 0x40e03ee0> chain <type_decl 0x40c45930 complex>>
        public unsigned SI
        size <integer_cst 0x4006e560 constant 32>
        unit size <integer_cst 0x4006e300 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x40cb8e70>
   
    arg 0 <var_decl 0x40d8a300 s.1575 type <record_type 0x40dfcf50 Complex>
        used DC file include/../linalg/basematrix.hpp line 107 col 16 size <integer_cst 0x4006e7a0 128> unit size <integer_cst 0x4006e7c0 16>
        align 64 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_>
        (concat:DC (reg:DF 99 [ s.1575 ])
    (reg:DF 100 [ s.1575+8 ]))
        chain <var_decl 0x40d8a360 D.49402 type <pointer_type 0x41218f50>
            used unsigned ignored SI file linalg/basematrix.cpp line 208 col 1 size <integer_cst 0x4006e560 32> unit size <integer_cst 0x4006e300 4>
            align 32 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_> chain <var_decl 0x40d8a3c0 D.49403>>>>
$19 = void
(gdb) 
 <addr_expr 0x4057eaa0
    type <pointer_type 0x40e031c0
        type <record_type 0x40dfcf50 Complex needs-constructing type_1 type_5 type_6 DC
            size <integer_cst 0x4006e7a0 constant 128>
            unit size <integer_cst 0x4006e7c0 constant 16>
            align 64 symtab 0 alias set -1 canonical type 0x40c458c0 fields <field_decl 0x40ca3c00 _M_value> context <namespace_decl 0x4007e770 std>
            full-name "struct ngbla::Complex"
            needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=2 interface-unknown
            pointer_to_this <pointer_type 0x40e031c0> reference_to_this <reference_type 0x40e03ee0> chain <type_decl 0x40c45930 complex>>
        public unsigned SI
        size <integer_cst 0x4006e560 constant 32>
        unit size <integer_cst 0x4006e300 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x40cb8e70>
   
    arg 0 <var_decl 0x40d8a300 s.1575 type <record_type 0x40dfcf50 Complex>
        used DC file include/../linalg/basematrix.hpp line 107 col 16 size <integer_cst 0x4006e7a0 128> unit size <integer_cst 0x4006e7c0 16>
        align 64 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_>
        (concat:DC (reg:DF 99 [ s.1575 ])
    (reg:DF 100 [ s.1575+8 ]))
        chain <var_decl 0x40d8a360 D.49402 type <pointer_type 0x41218f50>
            used unsigned ignored SI file linalg/basematrix.cpp line 208 col 1 size <integer_cst 0x4006e560 32> unit size <integer_cst 0x4006e300 4>
            align 32 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_> chain <var_decl 0x40d8a3c0 D.49403>>>>
Comment 4 John David Anglin 2009-06-20 21:57:33 UTC
The addr_expr originates here:

          /* If we're compiling a thunk, pass through invisible references
             instead of making a copy.  */
          if (call_from_thunk_p
              || (callee_copies
                  && !TREE_ADDRESSABLE (type)
                  && (base = get_base_address (args[i].tree_value))
                  && TREE_CODE (base) != SSA_NAME
                  && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
            {
              /* We can't use sibcalls if a callee-copied argument is
                 stored in the current function's frame.  */
              if (!call_from_thunk_p && DECL_P (base) && !TREE_STATIC (base))
                *may_tailcall = false;

              args[i].tree_value = build_fold_addr_expr (args[i].tree_value);
              type = TREE_TYPE (args[i].tree_value);

              if (*ecf_flags & ECF_CONST)
                *ecf_flags &= ~(ECF_CONST | ECF_LOOPING_CONST_OR_PURE);
            }

Breakpoint 7, initialize_argument_information (num_actuals=4, args=0xbff03660, 
    args_size=0xbff03554, n_named_args=4, exp=0x40f801c0, 
    struct_value_addr_value=0x0, fndecl=0x412cc780, fntype=0x40f564d0, 
    args_so_far=0xbff03564, reg_parm_stack_space=16, 
    old_stack_level=0xbff03588, old_pending_adj=0xbff0358c, 
    must_preallocate=0xbff03578, ecf_flags=0xbff0357c, 
    may_tailcall=0xbff03550 "", call_from_thunk_p=1 '\1')
    at ../../gcc/gcc/calls.c:1066
1066		      type = TREE_TYPE (args[i].tree_value);
(gdb) p debug_tree (args[i].tree_value)
 <addr_expr 0x4057eaa0
    type <pointer_type 0x40e031c0
        type <record_type 0x40dfcf50 Complex needs-constructing type_1 type_5 type_6 DC
            size <integer_cst 0x4006e7a0 constant 128>
            unit size <integer_cst 0x4006e7c0 constant 16>
            align 64 symtab 0 alias set -1 canonical type 0x40c458c0 fields <field_decl 0x40ca3c00 _M_value> context <namespace_decl 0x4007e770 std>
            full-name "struct ngbla::Complex"
            needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=2 interface-unknown
            pointer_to_this <pointer_type 0x40e031c0> reference_to_this <reference_type 0x40e03ee0> chain <type_decl 0x40c45930 complex>>
        public unsigned SI
        size <integer_cst 0x4006e560 constant 32>
        unit size <integer_cst 0x4006e300 constant 4>
        align 32 symtab 0 alias set -1 canonical type 0x40cb8e70>
   
    arg 0 <var_decl 0x40d8a300 s.1575 type <record_type 0x40dfcf50 Complex>
        used DC file include/../linalg/basematrix.hpp line 107 col 16 size <integer_cst 0x4006e7a0 128> unit size <integer_cst 0x4006e7c0 16>
        align 64 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_>
        (concat:DC (reg:DF 99 [ s.1575 ])
    (reg:DF 100 [ s.1575+8 ]))
        chain <var_decl 0x40d8a360 D.49402 type <pointer_type 0x41218f50>
            used unsigned ignored SI file linalg/basematrix.cpp line 208 col 1 size <integer_cst 0x4006e560 32> unit size <integer_cst 0x4006e300 4>
            align 32 context <function_decl 0x40f59180 _ZTv0_n64_NK4ngla12S_BaseMatrixISt7complexIdEE7MultAddES2_RKNS_10BaseVectorERS4_> chain <var_decl 0x40d8a3c0 D.49403>>>>
Comment 5 John David Anglin 2009-06-20 22:07:19 UTC
Oh, call_from_thunk_p is 1 and the var_decl is a pair of registers.  So,
there is no way to pass by reference without making a copy.
Comment 6 dave 2009-06-21 19:13:06 UTC
Subject: Re:  hppa: ICE: in expand_expr_addr_expr_1,
	at expr.c:6830

Untested patch attached for comment.

Dave
Comment 7 dave 2009-06-21 19:13:06 UTC
Created attachment 18042 [details]
calls.c.d
Comment 8 Steve Ellcey 2009-11-02 19:29:47 UTC
Dave,  did you get any comments on your proposed patch?  I just got a bug report from a GCC user that appears to be this same problem.
Comment 9 dave 2009-11-02 20:10:55 UTC
Subject: Re:  hppa: ICE: in expand_expr_addr_expr_1, at expr.c:6830

http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00374.html

Dave