gcc/testsuite/gcc.dg/asan/pr80166.c
raw| 1 | /* PR sanitizer/80166 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-additional-options "-Wno-stringop-overflow" } */ |
| 4 | |
| 5 | #include <sys/types.h> |
| 6 | #include <unistd.h> |
| 7 | |
| 8 | int |
| 9 | main (int argc, char **argv) |
| 10 | { |
| 11 | gid_t groups; |
| 12 | int r = getgroups (0, &groups); |
| 13 | if (r < 0) |
| 14 | __builtin_abort (); |
| 15 | |
| 16 | r = getgroups (-1, &groups); |
| 17 | if (r != -1) |
| 18 | __builtin_abort (); |
| 19 | |
| 20 | r = getgroups (-1, NULL); |
| 21 | if (r != -1) |
| 22 | __builtin_abort (); |
| 23 | |
| 24 | return 0; |
| 25 | } |