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

            Bug ID: 128937
           Summary: ICE in get_bit_vector_from_svalue, at
                    analyzer/symbolic-bit-vectors.cc
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: s.kimura.h41104 at gmail dot com
  Target Milestone: ---

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

Reproducer:
```
struct S {
  int *s;
  S() : s(new int) {}
  S(const S &r) noexcept : s(r.s) { __atomic_fetch_add(r.s, 1, 4); }
};

struct T {
  explicit T(const S &x) : t(x) {}
  const S t;
};

struct U {
  operator int() const {
    new T(u);
    return 0;
  }
  S u;
};

bool foo(int i);

void test() {
  U t;
  if (!foo(t))
    ;
}
```

Backtrace:
during IPA pass: analyzer
<source>: In copy constructor 'S::S(const S&)':
<source>:4:55: internal compiler error: in get_bit_vector_from_svalue, at
analyzer/symbolic-bit-vectors.cc:2615
    4 |   S(const S &r) noexcept : s(r.s) { __atomic_fetch_add(r.s, 1, 4); }
      |                                     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
0x2d38ce8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2d2d92b internal_error(char const*, ...)
        ???:0
0xc249a0 fancy_abort(char const*, int, char const*)
        ???:0
0x1ba0150 ana::region_model::set_value(ana::region const*, ana::svalue const*,
ana::region_model_context*)
        ???:0
0x1b6877f ana::kf_atomic_fetch_op::impl_call_pre(ana::call_details const&)
const
        ???:0
0x1b9ed06 ana::region_model::on_call_pre(gcall const&,
ana::region_model_context*)
        ???:0
0x1ba069f ana::region_model::on_stmt_pre(gimple const*, bool*,
ana::region_model_context*)
        ???:0
0x1b74afd ana::gimple_stmt_op::execute_on_state(ana::operation_context&,
ana::program_state) const
        ???:0
0x1b75772 ana::call_and_return_op::execute(ana::operation_context&) const
        ???:0
0x1b4ebcf ana::exploded_graph::process_node(ana::exploded_node*)
        ???:0
0x1b4f0c2 ana::exploded_graph::process_worklist()
        ???:0
0x1b51b65 ana::impl_run_checkers(ana::logger*)
        ???:0
0x1b52876 ana::run_checkers()
        ???:0

Reply via email to