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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |11.0
   Last reconfirmed|                            |2020-12-08

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
  wide_int min, max;
  if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE)
    {
      min = wi::to_wide (boolean_false_node);
      max = wi::to_wide (boolean_true_node);
    }

this is problematic - the BOOLEAN_TYPE of Ada has precision 8 but here
you're using the (LTO) middle-end boolean_*_node with precision 1 so
you'll get mismatched precision for min/max vs. lhs/rhs.

I'd suggest to do

   min = wi::zero (TYPE_PRECISION (TREE_TYPE (lhs));
   max = wi::one (TYPE_PRECISION (TREE_TYPE (lhs));

max should be appropriately sign/zero extended then.

Confirmed by code inspection.

Reply via email to