aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/overflow-add-4.c
blob: ac9df4d001ed2dc83cc3c09e19342394f7f5b839 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* { dg-do run } */
/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable -fsanitize-trap=undefined" } */
/* { dg-shouldfail "ubsan" } */

#define INT_MAX __INT_MAX__
#define INT_MIN (-__INT_MAX__ - 1)

int
main (void)
{
  volatile int j = INT_MAX;
  volatile int i = 1;
  volatile int k = j + i;
  return 0;
}