https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63573

--- Comment #14 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Andreas Schwab from comment #12)
> This also breaks g++.dg/ipa/pr63587-2.C on powerpc -m32, but the patches in
> #c6 and #c8 don't fix that.
> 
> $ gcc/xg++ -Bgcc/ ../gcc/testsuite/g++.dg/ipa/pr63587-2.C -nostdinc++
> -Ipowerpc64-linux/32/libstdc++-v3/include/powerpc64-linux
> -Ipowerpc64-linux/32/libstdc++-v3/include -I../libstdc++-v3/libsupc++
> -I../libstdc++-v3/include/backward -I../libstdc++-v3/testsuite/util
> -std=gnu++11 -O2 -S -m32 -o pr63587-2.s
> ../gcc/testsuite/g++.dg/ipa/pr63587-2.C: In static member function ‘static
> int
> boost::function_obj_invoker0<FunctionObj>::invoke(boost::function_buffer&)
> [with FunctionObj =
> boost::test_case_template_invoker<default_formatting_invoker>]’:
> ../gcc/testsuite/g++.dg/ipa/pr63587-2.C:21:3: internal compiler error: in
> expand_expr_addr_expr_1, at expr.c:7725

There's really problem that both suggested patches can fix just cases where
DECL_INCOMING_RTL is defined. In following situation:

static boost::log::make_output_actor<ActorT<LeftExprT>, RightT, ValueT>::type
boost::log::make_output_actor<ActorT<LeftExprT>, RightT,
ValueT>::make(ActorT<LeftExprT>, RightT&) [with ActorT = boost::actor;
LeftExprT =
boost::log::attribute_output_terminal<boost::actor<boost::log::attribute_output_terminal<boost::actor<int>,
boost::log::to_log_fun> >, boost::log::to_log_fun>; RightT =
boost::log::attribute_actor<int, boost::log::value_extractor, void,
boost::actor>; ValueT = int; boost::log::make_output_actor<ActorT<LeftExprT>,
RightT, ValueT>::type =
boost::actor<boost::log::attribute_output_terminal<boost::actor<boost::log::attribute_output_terminal<boost::actor<boost::log::attribute_output_terminal<boost::actor<int>,
boost::log::to_log_fun> >, boost::log::to_log_fun> >, boost::log::to_log_fun>
>] (struct actor left, struct attribute_actor & right)
{
  struct type D.4892;
  struct attribute_name D.4891;
  struct to_log_fun D.4890;
  struct actor left;

  <bb 2>:
  left = left;
  D.4891 = MEM[(struct attribute_terminal *)right_2(D)].m_name;
 
boost::log::attribute_output_terminal<boost::actor<boost::log::attribute_output_terminal<boost::actor<boost::log::attribute_output_terminal<boost::actor<int>,
boost::log::to_log_fun> >, boost::log::to_log_fun> >,
boost::log::to_log_fun>::attribute_output_terminal<int> (&D.4892, left, D.4891,
D.4890, 0);
  D.4892 ={v} {CLOBBER};
  return;

}

ICF introduces:
static boost::log::make_output_actor<ActorT<LeftExprT>, RightT, ValueT>::type
boost::log::make_output_actor<ActorT<LeftExprT>, RightT,
ValueT>::make(ActorT<LeftExprT>, RightT&) [with ActorT = boost::actor;
LeftExprT = int; RightT = boost::log::attribute_actor<{anonymous}::my_class,
boost::log::value_extractor, void, boost::actor>; ValueT = int;
boost::log::make_output_actor<ActorT<LeftExprT>, RightT, ValueT>::type =
boost::actor<boost::log::attribute_output_terminal<boost::actor<int>,
boost::log::to_log_fun> >] (struct actor left, struct attribute_actor & right)
{
  struct type <retval>;

  <bb 2>:
  <retval> = boost::log::make_output_actor<boost::actor<int>,
boost::log::attribute_actor<int, boost::log::value_extractor, void,
boost::actor>, int>::make (left, right_2(D)); [tail call]
  return <retval>;

}

with following call:
 <call_expr 0x3fffafbc2fc0
    type <record_type 0x3fffafba0000 type used needs-constructing type_5 type_6
QI
        size <integer_cst 0x3fffaf881518 constant 8>
        unit size <integer_cst 0x3fffaf881530 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x3fffafb3ff48
        fields <field_decl 0x3fffafb61138 proto_expr_ type <record_type
0x3fffafb71458 type>
            nonlocal decl_3 QI file ../gcc/testsuite/g++.dg/ipa/pr63587-2.C
line 145 col 48 size <integer_cst 0x3fffaf881518 8> unit size <integer_cst
0x3fffaf881530 1>
            align 8 offset_align 128
            offset <integer_cst 0x3fffaf881410 constant 0>
            bit offset <integer_cst 0x3fffaf881470 constant 0> context
<record_type 0x3fffafb3ff48 actor> chain <type_decl 0x3fffafb610a0 actor>>
context <namespace_decl 0x3fffaf984a38 boost>
        full-name "boost::log::make_output_actor<boost::actor<int>,
boost::log::attribute_actor<int, boost::log::value_extractor, void,
boost::actor>, int>::type"
        needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=1
interface-unknown
        pointer_to_this <pointer_type 0x3fffafbae9a0> chain <type_decl
0x3fffafb60be0 actor>>
    side-effects private protected
    fn <addr_expr 0x3fffafc130c0
        type <pointer_type 0x3fffafba0348 type <function_type 0x3fffafba00a8>
            unsigned SI
            size <integer_cst 0x3fffaf8813e0 constant 32>
            unit size <integer_cst 0x3fffaf8813f8 constant 4>
            align 32 symtab 0 alias set -1 canonical type 0x3fffafba03f0>
        constant
        arg 0 <function_decl 0x3fffafb51518 make type <function_type
0x3fffafba00a8>
            addressable asm_written used public static weak autoinline decl_1
decl_5 decl_6 SI file ../gcc/testsuite/g++.dg/ipa/pr63587-2.C line 208 col 3
align 32 context <record_type 0x3fffafb7fdf8 make_output_actor> initial
<error_mark 0x3fffaf8813c8> result <result_decl 0x3fffb18512c0 D.4281>
            full-name "static boost::log::make_output_actor<ActorT<LeftExprT>,
RightT, ValueT>::type boost::log::make_output_actor<ActorT<LeftExprT>, RightT,
ValueT>::make(ActorT<LeftExprT>, RightT&) [with ActorT = boost::actor;
LeftExprT = int; RightT = boost::log::attribute_actor<int,
boost::log::value_extractor, void, boost::actor>; ValueT = int;
boost::log::make_output_actor<ActorT<LeftExprT>, RightT, ValueT>::type =
boost::actor<boost::log::attribute_output_terminal<boost::actor<int>,
boost::log::to_log_fun> >]"
            pending-inline-info 0x3fffaf924e30 template-info 0x3fffafb86760
            (mem:SI (symbol_ref/i:SI
("_ZN5boost3log17make_output_actorINS_5actorIiEENS0_15attribute_actorIiNS0_15value_extractorEvS2_EEiE4makeES3_RS6_")
[flags 0x1] <function_decl 0x3fffafb51518 make>) [0  S4 A8])>>
    arg 0 <var_decl 0x3fffafc48f70 left
        type <record_type 0x3fffafb32f40 actor type_5 type_6 SI size
<integer_cst 0x3fffaf8813e0 32> unit size <integer_cst 0x3fffaf8813f8 4>
            align 32 symtab 0 alias set 1 canonical type 0x3fffafb32f40 fields
<field_decl 0x3fffaf98b810 proto_expr_> context <namespace_decl 0x3fffaf984a38
boost>
            full-name "struct boost::actor<int>"
            X() X(constX&) this=(X&) n_parents=0 use_template=1
interface-unknown
            pointer_to_this <pointer_type 0x3fffafb34398> reference_to_this
<reference_type 0x3fffafb34980> chain <type_decl 0x3fffaf98b648 actor>>
        addressable used SI file ../gcc/testsuite/g++.dg/ipa/pr63587-2.C line
21 col 3 size <integer_cst 0x3fffaf8813e0 32> unit size <integer_cst
0x3fffaf8813f8 4>
        align 32 context <function_decl 0x3fffafbb82c8 invoke> abstract_origin
<parm_decl 0x3fffafb97900 left>
        (reg/v:SI 180 [ left ])>
    arg 1 <addr_expr 0x3fffafc130e0
        type <pointer_type 0x3fffafb3de78 type <record_type 0x3fffafb3bbb0
attribute_actor>
            public unsigned SI size <integer_cst 0x3fffaf8813e0 32> unit size
<integer_cst 0x3fffaf8813f8 4>
            align 32 symtab 0 alias set -1 canonical type 0x3fffafb3de78>

        arg 0 <var_decl 0x3fffafc48160 right type <record_type 0x3fffafb3bbb0
attribute_actor>
            addressable used SI file ../gcc/testsuite/g++.dg/ipa/pr63587-2.C
line 245 col 1 size <integer_cst 0x3fffaf8813e0 32> unit size <integer_cst
0x3fffaf8813f8 4>
            align 32 context <function_decl 0x3fffafbb82c8 invoke>
abstract_origin <parm_decl 0x3fffafb0cb80 right>
            (mem/c:SI (plus:SI (reg/f:SI 150 virtual-stack-vars)
        (const_int 12 [0xc])) [13 right+0 S4 A32])>>>

Problem is that 'left' is placed to register and there's no DECL_INCOMING_RTL
for VAR_DECL 'left'.
Honza, what do you think about correct RTL expansion done in function.c instead
of taking DECL_INCOMING_RTL that doen't fix this new problem?

Thanks,
Martin

Reply via email to