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

            Bug ID: 120048
           Summary: ICE on valid code at -O{s,2} with "-fno-tree-vrp
                    -fno-tree-fre" on x86_64-linux-gnu: in type, at
                    value-range.h:982
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a very recent regression as it doesn't reproduce with 15.1 and
earlier.

Compiler Explorer: https://godbolt.org/z/eKaE7M76c

[611] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250430 (experimental) (GCC) 
[612] % 
[612] % gcctk -O2 -fno-tree-vrp -fno-tree-fre small.c
during IPA pass: cp
small.c:9:1: internal compiler error: in type, at value-range.h:982
    9 | int main() { f(c | 1); }
      | ^~~
0x2701df6 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0xacb49e fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1748
0xb9ceb3 irange::type() const
        ../../gcc-trunk/gcc/value-range.h:982
0xf9ba74 ipa_vr::ipa_vr(vrange const&)
        ../../gcc-trunk/gcc/ipa-prop.cc:150
0x253fb5c ipcp_store_vr_results
        ../../gcc-trunk/gcc/ipa-cp.cc:6365
0x25405aa ipcp_driver
        ../../gcc-trunk/gcc/ipa-cp.cc:6442
0x25405aa execute
        ../../gcc-trunk/gcc/ipa-cp.cc:6513
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[613] % 
[613] % cat small.c
int a, b, c;
static int d(short e) { return e || (a && e) ? 0 : a; }
static void f(int e) {
  if (!e) {
    d(0);
    b = d(e);
  }
}
int main() { f(c | 1); }

Reply via email to