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

            Bug ID: 128190
           Summary: ICE in lower_stmt, at gimple-lower-bitint.cc:6781
                    converting a fixed-point value to _BitInt(65); _BitInt
                    to fixed-point is rejected
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yuki.tanaka at defaultcase dot de
  Target Milestone: ---

_BitInt(65) a(_Accum x)
{
  return x;
}

during GIMPLE pass: bitintlower
<source>: In function 'a':
<source>:1:13: internal compiler error: in lower_stmt, at
gimple-lower-bitint.cc:6781
    1 | _BitInt(65) a(_Accum x)
      |             ^
/cefs/5c/5cc46c1dc147fb72789d06eb_arm_gcc-trunk-20261026/arm-unknown-linux-gnueabihf/bin/../libexec/gcc/arm-unknown-linux-gnueabihf/17.0.0/cc1
-quiet -iprefix
/cefs/5c/5cc46c1dc147fb72789d06eb_arm_gcc-trunk-20261026/arm-unknown-linux-gnueabihf/bin/../lib/gcc/arm-unknown-linux-gnueabihf/17.0.0/
-isysroot
/cefs/5c/5cc46c1dc147fb72789d06eb_arm_gcc-trunk-20261026/arm-unknown-linux-gnueabihf/bin/../arm-unknown-linux-gnueabihf/sysroot
<source> -quiet -dumpdir /app/ -dumpbase output.c -dumpbase-ext .c
-mfloat-abi=hard -mfpu=neon -mtls-dialect=gnu -mthumb -mlibarch=armv7-a+simd
-march=armv7-a+simd -g -O2 -fdiagnostics-color=always -fno-verbose-asm -o
/app/output.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

This is valid code: GCC accepts conversions between fixed-point and integer
types, and _BitInt(65) is an integer type. It should compile, as it does for
_BitInt(64) and narrower. Instead GCC ICEs at -O{0,1,2,s}.

The other direction is rejected for every _BitInt width:

_Accum b(_BitInt(8) x)
{
  return x;
}

<source>: In function 'b':
<source>:3:3: error: aggregate value used where a fixed-point was expected
    3 |   return x;
      |   ^~~~~~
Compiler returned: 1

There is no aggregate here, and the same function with int instead of
_BitInt(8) compiles. Casts and arithmetic such as y + x with a _BitInt operand
give the same error.

Compiler Explorer:
https://godbolt.org/z/an4jK7GTz
  • [Bug middle-end/128190] New... yuki.tanaka at defaultcase dot de via Gcc-bugs

Reply via email to