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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Keywords|needs-bisection,            |
                   |needs-reduction             |
            Summary|internal compiler error: in |ICE in
                   |get_or_create_mem_ref, at   |get_or_create_mem_ref, at
                   |analyzer/region-model.cc:69 |analyzer/region-model.cc:69
                   |38                          |38 since
                   |                            |r10-5950-g757bf1dff5e8cee3

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ struct n;
class o {
public:
  using d = n;
  d operator*();
};
class p {
public:
  p(char *);
  void operator=(p);
};
template <class ad> class q {
public:
  ad operator*();
};
void(ag)(int(int *));
auto a = [] {};
int f, g;
class r {
public:
  template <typename i, typename j> void k(p aj, j i::*ak) {
    auto b = [=](i am, j c) { am.*ak = c; };
    k<j>(aj, a, b);
  }
  template <typename, typename an, typename ao> void k(p aj, an, ao ap) {
    aq(aj, 0, ap);
  }
  int as;
  template <typename> struct s {};
  template <typename aw, typename ax> void ay(int *az, int, p, ax ba) {
    t<aw>::bc(az, ba);
  }
  template <typename an, typename ao> void aq(p aj, an, ao ap) {
    ay<void(o, p)>(&as, 4, aj, [ap](o bj, p c) { ap(*bj, c); });
  }
  template <typename> struct t;
  template <typename bl> struct I { static auto bn(int *, int) -> q<bl>; };
  template <typename bo, typename l> static auto bp(int *, bo, l bq, int) {
    bq();
  }
  template <typename bo, typename l, typename br, typename... bs>
  static auto bp(int *az, bo bt, l bq, int bu, s<br>, bs... bv) {
    auto c = I<br>::bn(az, bu);
    J<l, br> d{bq, *c};
    bp(az, bt, d, 1, bv...);
  }
  template <typename by, typename bz> struct J {
    by ca;
    bz cb;
    template <typename... cc> void operator()(cc... cd) { ca(cb, cd...); }
  };
};
template <typename ce, typename... cf> struct r::t<ce(cf...)> {
  template <typename by> static auto bc(int *, by) {
    auto e = [](int *) -> int { bq(static_cast<by *>(0)); };
    ag(e);
  }
  template <typename by> static auto bq(by ch) { cj(*ch); }
  template <typename by> static auto cj(by ch) {
    bp(&g, int{}, ch, f, s<cf>{}...);
  }
};
struct n {
  p aj;
};
r h;
void m() { h.k("", &n::aj); }

$ g++ -fanalyzer x.ii -c -O3
x.ii: In lambda function:
x.ii:55:59: warning: no return statement in function returning non-void
[-Wreturn-type]
   55 |     auto e = [](int *) -> int { bq(static_cast<by *>(0)); };
      |                                                           ^
x.ii: In function ‘void m()’:
x.ii:67:16: warning: ISO C++ forbids converting a string constant to ‘char*’
[-Wwrite-strings]
   67 | void m() { h.k("", &n::aj); }
      |                ^~
during IPA pass: analyzer
x.ii: In lambda function:
x.ii:22:14: internal compiler error: in get_or_create_mem_ref, at
analyzer/region-model.cc:6938
   22 |     auto b = [=](i am, j c) { am.*ak = c; };
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x86fc20 ana::region_model::get_or_create_mem_ref(tree_node*, ana::svalue_id,
ana::svalue_id, ana::region_model_context*)
        /home/marxin/Programming/gcc/gcc/analyzer/region-model.cc:6938
0x1448285 ana::region_model::get_or_create_pointer_plus_expr(tree_node*,
ana::svalue_id, ana::svalue_id, ana::region_model_context*)
        /home/marxin/Programming/gcc/gcc/analyzer/region-model.cc:7021
0x1448285 ana::region_model::on_assignment(gassign const*,
ana::region_model_context*)
        /home/marxin/Programming/gcc/gcc/analyzer/region-model.cc:4197
0x141c12f ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::state_change*) const
        /home/marxin/Programming/gcc/gcc/analyzer/engine.cc:1019
0x141ca31 ana::exploded_graph::process_node(ana::exploded_node*)
        /home/marxin/Programming/gcc/gcc/analyzer/engine.cc:2530
0x141ce82 ana::exploded_graph::process_worklist()
        /home/marxin/Programming/gcc/gcc/analyzer/engine.cc:2348
0x141f0de ana::impl_run_checkers(ana::logger*)
        /home/marxin/Programming/gcc/gcc/analyzer/engine.cc:4029
0x1420abc ana::run_checkers()
        /home/marxin/Programming/gcc/gcc/analyzer/engine.cc:4097
0x1414ea8 execute
        /home/marxin/Programming/gcc/gcc/analyzer/analyzer-pass.cc:84
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to