summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/errno-1.c
blob: d0365bed45b066681a13180f097707df96bbc570 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-options "-O2" } */

#include <errno.h>
#include <stdlib.h>

int main()
{
  void *p;
  errno = 0;
  p = malloc (-1);
  if (errno != 0)
    do_not_optimize_away ();
  return 0;
}

/* { dg-final { scan-assembler "do_not_optimize_away" } } */