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]

[C++ Patch] PR 84333 ("[6/7/8 Regression] ICE with ternary operator in template function")


Hi,

this ICE on valid happens only with checking enabled - that explains why we didn't notice it so far - but I think points to a minor but substantive correctness issue. In short, we ICE when build_conditional_expr calls save_expr, which in turn calls contain_placeholder_p, which doesn't handle correctly the sizeof(int), and tries to use TREE_CONSTANT on the INTEGER_TYPE. I think that in general we simply have to explicitly handle both kinds of sizeof in contains_placeholder_p: even for a type as simple as INTEGER_TYPE the result may not be trivial, ie, type_contains_placeholder_1 checks the bounds:

   case INTEGER_TYPE:
    case REAL_TYPE:
    case FIXED_POINT_TYPE:
      /* Here we just check the bounds.  */
      return (CONTAINS_PLACEHOLDER_P (TYPE_MIN_VALUE (type))
          || CONTAINS_PLACEHOLDER_P (TYPE_MAX_VALUE (type)));

I'm finishing testing the below on x86_64-linux, all good so far.

Thanks, Paolo.

//////////////////

Attachment: CL_84333
Description: Text document

Attachment: patch_84333
Description: Text document


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