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

            Bug ID: 128738
           Summary: [16/17 Regression] ICE: RTL check: expected code
                    'const_int', have 'reg' in
                    simplify_binary_operation_1, at simplify-rtx.cc:3929
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shimizu2486 at gmail dot com
  Target Milestone: ---

$ cat t1.c
int f(int x, int m) { return ((x >> 1) & 1) | ((x & m) != 0); }

$ arm-linux-gnueabihf-gcc -O2 -c t1.c
during RTL pass: combine
t1.c: In function 'f':
t1.c:1:63: internal compiler error: RTL check: expected code 'const_int', have
'reg' in simplify_binary_operation_1, at simplify-rtx.cc:3929
    1 | int f(int x, int m) { return ((x >> 1) & 1) | ((x & m) != 0); }
      |                                                               ^
Please submit a full bug report, with preprocessed source (by using
-freport-bug).

  arm trunk (8463cbc0c69c)   ICE
  arm 16.2.0                 ICE
  arm 15.3.0                 compiles

To reproduce, GCC needs to be configured with --enable-checking=yes,extra,rtl
(and thus compiler explorer's compiler does not show the rtl check error).
-O1, -O2, -O3 and -Os ICE. -O0 and -Og compile it.
aarch64 trunk and 16.2.0 ICE the same way. x86-64 compiles it just fine.

Reply via email to