aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/ubsan/return-2.C
blob: 546f1781057955e71ac7b4273325f3ddc4e3b0ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// { dg-do run }
// { dg-options "-fsanitize=return" }

#include <stdio.h>

struct S { S (); ~S (); };

S::S () {}
S::~S () {}

int
foo (int x)
{
  S a;
  {
    S b;
    if (x)
      return 1;
  }
}

int
main ()
{
  fputs ("UBSAN TEST START\n", stderr);

  foo (1);
  foo (14);

  fputs ("UBSAN TEST END\n", stderr);
}

/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */