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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Far from having a usable testcase, but having a clobber with reg type (which is
what the ICE is on when trying to regimplify it) is quite easy, e.g.
#include <optional>

struct T { T (); ~T (); T (const T &); };

struct S {
  T a;
  std::optional<int> frame_size_window = std::nullopt;
  T b;
};

void
foo ()
{
  S s;
  s.frame_size_window = std::nullopt;
}
does that with g++ -O2 -std=c++23 -S -fdump-tree-ssa.
void std::_Optional_payload_base<int>::_M_destroy (struct
_Optional_payload_base * const this)
{
  int * _1;

  <bb 2> :
  this_3(D)->_M_engaged = 0;
  _1 = &this_3(D)->_M_payload._M_value;
  *_1 ={v} {CLOBBER(eob)};
  return;

}

Or even
template <typename T>
struct S {
  int *p;
  union { char a; T b; };
  void foo () { b.~T (); }
};

void
bar (S <int> &s)
{
  s.foo ();
}

Reply via email to