gcc/testsuite/gcc.dg/errno-1.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2" } */ |
| 3 | |
| 4 | #include <errno.h> |
| 5 | #include <stdlib.h> |
| 6 | |
| 7 | void do_not_optimize_away (); |
| 8 | |
| 9 | int main() |
| 10 | { |
| 11 | void * volatile p; |
| 12 | errno = 0; |
| 13 | /* The malloc call below may cause a -Walloc-size-larger-than warning. */ |
| 14 | p = malloc (-1); |
| 15 | if (errno != 0) |
| 16 | do_not_optimize_away (); |
| 17 | return 0; |
| 18 | } |
| 19 | |
| 20 | /* { dg-final { scan-assembler "do_not_optimize_away" } } */ |
| 21 | /* { dg-prune-output "exceeds maximum object size" } */ |