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

            Bug ID: 125911
           Summary: ICE at -O3 with PGO in value_of_expr, at
                    tree-vrp.cc:996 during GIMPLE pass: vrp
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xintong.zhou1 at uwaterloo dot ca
  Target Milestone: ---

Created attachment 64810
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64810&action=edit
The profile data for PGO.

The ICE happens when using the attached profile to compile small.c with PGO on
aarch64.

To reproduce the ICE, put the attached profile (a-small.gcda) in the same
directory as small.c and compile as follows:

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/data/x27zhou/compiler-nightly/install/gcc/libexec/gcc/aarch64-unknown-linux-gnu/17.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: /data/x27zhou/compiler-nightly/src/gcc/configure
--enable-checking=yes --disable-bootstrap --disable-multilib
--enable-languages=c,c++ --prefix=/data/x27zhou/compiler-nightly/install/gcc
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260619 (experimental) (GCC)
$
$
$ gcc-trunk -O3 small.c
$
$ gcc-trunk -O3 -fprofile-use small.c
during GIMPLE pass: vrp
small.c: In function ā€˜j’:
small.c:28:6: internal compiler error: in value_of_expr, at tree-vrp.cc:996
   28 | void j() {
      |      ^
cc1: some warnings being treated as errors
0x2530bd7 internal_error(char const*, ...)
       
/data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x87b963 fancy_abort(char const*, int, char const*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostics/context.cc:1813
0x14bf877 rvrp_folder::value_of_expr(tree_node*, gimple*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-vrp.cc:996
0x134d7c7 substitute_and_fold_engine::replace_uses_in(gimple*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-propagate.cc:575
0x134da13 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-propagate.cc:854
0x21c61ff dom_walker::walk(basic_block_def*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/domwalk.cc:311
0x134cb17 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-ssa-propagate.cc:1003
0x14bbf97 execute_ranger_vrp(function*, bool)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-vrp.cc:1096
/data/x27zhou/compiler-nightly/install/gcc/libexec/gcc/aarch64-unknown-linux-gnu/17.0.0/cc1
-quiet -imultiarch aarch64-linux-gnu small.c -quiet -dumpdir a- -dumpbase
small.c -dumpbase-ext .c -mlittle-endian -mabi=lp64 -O3 -fprofile-use -o
/tmp/cc4htgUc.s
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.
$
$ cat small.c
#include <assert.h>
static int a, d, c, b, e, f, g, m;
unsigned k;
int o;
int *p;
void h() { assert(c || f); }
static int *i() {
  int *l = 0;
  for (int h = 0; h < 7; h++)
    g = (0 <= k) - a;
  if (g) {
    int i;
    for (int j = 0; j < 5; j++)
      l = &i;
    switch (d)
    case 1:
      e = *l;
    for (; m;)
      goto ak;
    assert(d || b);
  am:
    d--;
  ak:
    return l;
  }
  goto am;
}
void j() {
  switch (o)
  case 1: {
    p = i();
    for (int n; n; h())
      i();
  }
}
void main() {}
  • [Bug tree-optimization/1259... xintong.zhou1 at uwaterloo dot ca via Gcc-bugs

Reply via email to