1 /* { dg-do run } */
2 /* { dg-options "-fsanitize=undefined" } */
3
4 #include <stdio.h>
5
6 __attribute__((noinline, noclone)) unsigned long long
foo(unsigned int x,unsigned long int y,unsigned long long int z,__UINTMAX_TYPE__ w)7 foo (unsigned int x, unsigned long int y, unsigned long long int z, __UINTMAX_TYPE__ w)
8 {
9 unsigned long long ret = 0;
10 fprintf (stderr, "FOO MARKER1\n");
11 ret += __builtin_ctz (x);
12 ret += __builtin_ctzl (y);
13 ret += __builtin_ctzll (z);
14 ret += __builtin_ctzimax (w);
15 fprintf (stderr, "FOO MARKER2\n");
16 ret += __builtin_clz (x);
17 ret += __builtin_clzl (y);
18 ret += __builtin_clzll (z);
19 ret += __builtin_clzimax (w);
20 fprintf (stderr, "FOO MARKER3\n");
21 return ret;
22 }
23
24 int
main()25 main ()
26 {
27 volatile __UINTMAX_TYPE__ t = 0;
28 t = foo (t, t, t, t);
29 return 0;
30 }
31
32 /* { dg-output "FOO MARKER1(\n|\r\n|\r)" } */
33 /* { dg-output "(\[^\n\r]*runtime error: passing zero to ctz\\\(\\\), which is not a valid argument\[^\n\r]*(\n|\r\n|\r)){4}" } */
34 /* { dg-output "FOO MARKER2(\n|\r\n|\r)" } */
35 /* { dg-output "(\[^\n\r]*runtime error: passing zero to clz\\\(\\\), which is not a valid argument\[^\n\r]*(\n|\r\n|\r)){4}" } */
36 /* { dg-output "FOO MARKER3" } */
37