(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
asan/
pr78541.c
       1  // PR sanitizer/78560
       2  // { dg-do run }
       3  // { dg-shouldfail "asan" }
       4  
       5  void foo (double a, double b)
       6  {
       7    double *ptr;
       8      {
       9        double x = a + b;
      10        ptr = &x;
      11      }
      12   double square () { __builtin_printf ("", *ptr); }
      13  
      14   square ();
      15  }
      16  
      17  int main()
      18  {
      19    foo (1.2f, 2.3f);
      20    return 0;
      21  }
      22  
      23  // { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
      24  // { dg-output "READ of size.*" }
      25  // { dg-output ".*'x' \\(line 9\\) <== Memory access at offset \[0-9\]* is inside this variable.*" }