diff mbox

[resend] - Probable buglet in ipa-prop.c

Message ID 5296648B.4020805@redhat.com
State New
Headers show

Commit Message

Andrew MacLeod Nov. 27, 2013, 9:30 p.m. UTC
mailer added html again...
----------------------------------------

When trying some of my updated prototype changes on trunk, the code
tripped over this segment in ipa-prop.c :

        lhs = gimple_assign_lhs (stmt);
        rhs = gimple_assign_rhs1 (stmt);
        if (!is_gimple_reg_type (rhs)
            || TREE_CODE (lhs) == BIT_FIELD_REF
            || contains_bitfld_component_ref_p (lhs))
          break;

I had converted "gimple_reg_type(tree)" to instead be "gimple_reg_type
(gimple_type)",  and during bootstrap it conked out because it received
an SSA_NAME instead of a type.

static inline bool
is_gimple_reg_type (tree type)
{
   return !AGGREGATE_TYPE_P (type);
}


It never triggered before because  AGGREGATE_TYPE_P(TYPE) just checks
the tree codes, and doesn't do a TYPE_CHECK()

#define AGGREGATE_TYPE_P(TYPE) \
   (TREE_CODE (TYPE) == ARRAY_TYPE || RECORD_OR_UNION_TYPE_P (TYPE))


I think it should probably be passing TREE_TYPE (rhs) liek so  ?

Andrew

Comments

Jeff Law Nov. 27, 2013, 10:16 p.m. UTC | #1
On 11/27/13 14:30, Andrew MacLeod wrote:
> mailer added html again...
> ----------------------------------------
>
> When trying some of my updated prototype changes on trunk, the code
> tripped over this segment in ipa-prop.c :
>
>         lhs = gimple_assign_lhs (stmt);
>         rhs = gimple_assign_rhs1 (stmt);
>         if (!is_gimple_reg_type (rhs)
>             || TREE_CODE (lhs) == BIT_FIELD_REF
>             || contains_bitfld_component_ref_p (lhs))
>           break;
>
> I had converted "gimple_reg_type(tree)" to instead be "gimple_reg_type
> (gimple_type)",  and during bootstrap it conked out because it received
> an SSA_NAME instead of a type.
Which probably caused everything after that conditional to be dead code.

> I think it should probably be passing TREE_TYPE (rhs) liek so  ?
Yup.  Agreed.  Feel free to submit the fix.  It'll be interested to see 
how many of these we find as this work progresses.

It'll also be interesting to see if there's any fallout from the 
previously dead code now getting a chance to do something useful.

jeff
diff mbox

Patch

Index: ipa-prop.c
===================================================================
*** ipa-prop.c	(revision 205351)
--- ipa-prop.c	(working copy)
*************** determine_known_aggregate_parts (gimple
*** 1424,1430 ****
  
        lhs = gimple_assign_lhs (stmt);
        rhs = gimple_assign_rhs1 (stmt);
!       if (!is_gimple_reg_type (rhs)
  	  || TREE_CODE (lhs) == BIT_FIELD_REF
  	  || contains_bitfld_component_ref_p (lhs))
  	break;
--- 1424,1430 ----
  
        lhs = gimple_assign_lhs (stmt);
        rhs = gimple_assign_rhs1 (stmt);
!       if (!is_gimple_reg_type (TREE_TYPE (rhs))
  	  || TREE_CODE (lhs) == BIT_FIELD_REF
  	  || contains_bitfld_component_ref_p (lhs))
  	break;