[Bug c/46547] [4.5/4.6 Regression] internal compiler error when converting a complex to a bool

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 19 08:47:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46547

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-19 08:38:53 UTC ---
The problem is that c_fully_fold_internal doesn't recurse on the RHS of a
MODIFY_EXPR:
      /* The RHS of a MODIFY_EXPR was fully folded when building that
         expression for the sake of conversion warnings.  */
While this is true, here RHS was INDIRECT_REF of a POSTINCREMENT_EXPR of
PARM_DECL, all with COMPLEX_TYPE or pointers to that and it was fully folded.
But afterwards when this RHS is convert()ed to the LHS type,
c_common_truthvalue_conversion is called and introduces new C_MAYBE_CONST_EXPRs
into it.
I wonder if we couldn't swap the order of c_fully_fold and
convert_for_assignment
in build_modify_expr:
      newrhs = c_fully_fold (newrhs, false, NULL);
      if (rhs_semantic_type)
        newrhs = build1 (EXCESS_PRECISION_EXPR, rhs_semantic_type, newrhs);
      newrhs = convert_for_assignment (location, lhstype, newrhs, rhs_origtype,
                                       ic_assign, npc, NULL_TREE, NULL_TREE,
0);
so that it would be fully folding also whatever was added by
convert_for_assignment.  Joseph?



More information about the Gcc-bugs mailing list