view gcc/testsuite/c-c++-common/ubsan/overflow-add-4.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-fsanitize=signed-integer-overflow -Wno-unused-variable -fsanitize-undefined-trap-on-error" } */
/* { 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;
}