Debian Codegraph @

gcc/testsuite/gcc.dg/ubsan/pr88234.c

raw
1 /* PR target/88234 */
2 /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */
3 /* { dg-options "-fsanitize=signed-integer-overflow -fno-sanitize-recover=signed-integer-overflow -O2 -maltivec" } */
4 /* { dg-require-effective-target powerpc_altivec } */
5
6 #include <altivec.h>
7
8 __attribute__((noipa)) vector unsigned int
9 f1 (vector unsigned int x, vector unsigned int y)
10 {
11 return vec_add (x, y);
12 }
13
14 __attribute__((noipa)) vector unsigned int
15 f2 (vector unsigned int x, vector unsigned int y)
16 {
17 return vec_sub (x, y);
18 }
19
20 int
21 main ()
22 {
23 vector unsigned int x = { __INT_MAX__, -__INT_MAX__, __INT_MAX__ - 3, -__INT_MAX__ + 4 };
24 vector unsigned int y = { 1, -1, 4, -5 };
25 vector unsigned int z = f1 (x, y);
26 f2 (z, x);
27 f2 (z, y);
28 return 0;
29 }