repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git]
/
main
/
gcc
/
testsuite
/
c-c++-common
/
ubsan
/
undefined-1.c
blob
d1b9ce78771f5fdf68aa46edf1c7290169739466
1
/* { dg-do run } */
2
/* { dg-options "-fsanitize=undefined" } */
3
4
#include <stdio.h>
5
6
int
7
foo
(
int
x
,
int
y
)
8
{
9
const int
z
=
2
;
10
if
(
z
&
1
)
11
return
x
<<
y
;
12
return
0
;
13
}
14
15
int
16
bar
(
int
x
,
int
y
)
17
{
18
return
x
+
y
;
19
}
20
21
int
22
main
(
void
)
23
{
24
fputs
(
"UBSAN TEST START
\n
"
,
stderr
);
25
26
foo
(
3
,
2
);
27
bar
(
12
,
42
);
28
29
fputs
(
"UBSAN TEST END
\n
"
,
stderr
);
30
return
0
;
31
}
32
33
/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */