(root)/
gcc-13.2.0/
gcc/
testsuite/
g++.dg/
ubsan/
pr105729.C
// PR sanitizer/105729
// { dg-do run }
// { dg-options "-fsanitize=null -fno-sanitize-recover=null" }

int
foo (int x)
{
  throw 0;
}

struct S {};
struct T {
  S *data;
  T () : data (0) {}
  const S &bar (int x) const { return data[foo (x)]; }
};

int
main ()
{
  T t;
  try
    {
      t.bar (-1);
    }
  catch (...)
    {
    }
}