* auto-profile.c (afdo_annotate_cfg): Use update_max_bb_count.
[official-gcc.git] / gcc / testsuite / g++.dg / ubsan / vptr-9.C
blob9fce5841b5e9e78a8acd94f4feda05c7b9773bcd
1 // { dg-do run }
2 // { dg-shouldfail "ubsan" }
3 // { dg-options "-fsanitize=vptr -fno-sanitize-recover=undefined" }
5 struct S { virtual int f () { return 0; } };
6 struct T : virtual S {};
7 struct U { virtual int f () { return 0; } };
9 int
10 main ()
12   U u;
13   T *t = (T *) &u;
14   S *s = t;
15   return s->f ();
18 // { dg-output "\[^\n\r]*vptr-9.C:14:\[0-9]*: runtime error: cast to virtual base of address 0x\[0-9a-fA-F]* which does not point to an object of type 'T'(\n|\r\n|\r)" }
19 // { dg-output "0x\[0-9a-fA-F]*: note: object is of type 'U'(\n|\r\n|\r)" }
20 // { dg-output "  ?.. .. .. ..  ?.. .. .. ..  ?.. .. .. .. \[^\n\r]*(\n|\r\n|\r)" }
21 // { dg-output "              ?\\^~~~~~~~~~~\[^\n\r]*(\n|\r\n|\r)" }
22 // { dg-output "              ?vptr for 'U'" }