middle-end: Fix stalled swapped condition code value [PR115836]
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / stdarg-pr111289-int.c
blob8faa58c94805e6d36f325e8ad731bbc95483238c
1 #include <stdarg.h>
2 #include <stdint.h>
4 typedef unsigned int mode_t;
6 extern void openat (int, const char *, int, mode_t);
8 /* Signed vs unsigned of same integral type. */
10 static void
11 test_1 (char const *name, ...)
13 va_list arg;
14 va_start (arg, name);
16 mode_t mode = va_arg (arg, mode_t); /* { dg-bogus "-Wanalyzer-va-arg-type-mismatch" } */
18 va_end (arg);
19 openat (-42, name, 0, mode);
22 void
23 call_test_1 ()
25 test_1 ("nonexist.ent/", 0600);
28 /* Not the same size: small enough for int promotion. */
30 int16_t global_2;
32 static void
33 test_2 (char const *name, ...)
35 va_list arg;
36 va_start (arg, name);
38 global_2 = va_arg (arg, int16_t); /* { dg-warning "promoted to 'int'" } */
40 va_end (arg);
43 void
44 call_test_2 ()
46 test_2 ("nonexist.ent/", 42);
49 /* Not the same size: too big for int promotion. */
51 long long global_3;
53 static void
54 test_3 (char const *name, ...)
56 va_list arg;
57 va_start (arg, name);
59 global_3 = va_arg (arg, long long); /* { dg-warning "'va_arg' expected 'long long int' but received 'int' for variadic argument 1 of 'arg'" } */
61 va_end (arg);
64 void
65 call_test_3 ()
67 test_3 ("nonexist.ent/", 42);