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

            Bug ID: 122856
           Summary: ICE: in decide_about_value, at ipa-cp.cc
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

Only go crash with the optimization flag -O3.
Compiler Explorer: https://godbolt.org/z/z498eTPfb

The program:
```c
template <typename T>
class Base {
public:
    virtual int get();
    virtual ~Base() = default;
};

template <typename T>
class Derived : public Base<T> {
public:
    int get() override { return Base<T>::get(); }
};

template <typename T>
int Base<T>::get() {

    return static_cast<Derived<int>*>(this)->get();
}

int main() {
    Derived<int> d;
    return d.get();  
}
```

The traceback:
1154.fuzz:25:1: internal compiler error: in decide_about_value, at
ipa-cp.cc:6007
   25 | }
      | ^
0x5da1dc8 internal_error(char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:517
0x5d3f858 fancy_abort(char const*, int, char const*)
        /workspace/install/gcc/src/gcc/gcc/diagnostic.cc:1749
0x5858ebc decide_about_value<tree_node*>
        /workspace/install/gcc/src/gcc/gcc/ipa-cp.cc:6007
0x585529b decide_whether_version_node
        /workspace/install/gcc/src/gcc/gcc/ipa-cp.cc:6119
0x5856219 ipcp_decision_stage
        /workspace/install/gcc/src/gcc/gcc/ipa-cp.cc:6301
0x5857a55 ipcp_driver
        /workspace/install/gcc/src/gcc/gcc/ipa-cp.cc:6486
0x5857e06 execute
        /workspace/install/gcc/src/gcc/gcc/ipa-cp.cc:6559
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.

The gcc version I used is:
Using built-in specs.
COLLECT_GCC=/workspace/install/gcc/install_15.2.0/bin/gcc
COLLECT_LTO_WRAPPER=/workspace/install/gcc/install_15.2.0/libexec/gcc/x86_64-pc-linux-gnu/15.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/install/gcc/src/gcc/configure --enable-coverage
--enable-checking --disable-multilib --disable-shared --disable-bootstrap
--enable-languages=c,c++ --prefix=/workspace/install/gcc/install_15.2.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.2.0 (GCC)

Reply via email to