1// Test that debug info generated for auto-inserted deallocator is 2// correctly attributed. 3// This patch scans for the lineno directly from assembly, which may 4// differ between different architectures. Because it mainly tests 5// FE generated debug info, without losing generality, only x86 6// assembly is scanned in this test. 7// { dg-do compile { target { i?86-*-* x86_64-*-* } } } 8// { dg-options "-O2 -fno-exceptions -g -dA" } 9 10struct t { 11 t (); 12 ~t (); 13 void foo(); 14 void bar(); 15}; 16 17int bar(); 18 19void foo(int i) 20{ 21 t test_outside; 22 for (int j = 0; j < 10; j++) 23 { 24 t test; 25 test.foo(); 26 if (i + j) 27 { 28 test.bar(); 29 return; 30 } 31 } 32 if (i) 33 { 34 t test; 35 if (i == 10) 36 { 37 test.bar(); 38 } 39 } 40 test_outside.foo(); 41 return; 42} 43// { dg-final { scan-assembler "deallocator.C:29" } } 44// { dg-final { scan-assembler "deallocator.C:24" } } 45// { dg-final { scan-assembler "deallocator.C:34" } } 46// { dg-final { scan-assembler "deallocator.C:21" } } 47