[Bug sanitizer/108481] [13 Regression] UBsan missed a signed integer overflow

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 31 03:57:16 GMT 2023


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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
      i = i - 6822162149299574294;

Is not being invoked on the executable code.

If we look at look at the original code:


    if ((i * (unsigned long)7 <= 1) << j)
      ;
    else {
      i = i - 6822162149299574294;
      if (j) {
        if (*g)
          break;
        continue;
      }
      return 8;
    }
...
  return h;

The only path where the undefined behavior even matters is inside the path that
had continue in it. Which is where the subtraction is pushed to now.

I don't know if we should declear this as a valid thing to do or not.


More information about the Gcc-bugs mailing list