File: e_intmax.c

package info (click to toggle)
mcpp 2.7.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,024 kB
  • ctags: 29,151
  • sloc: ansic: 35,191; sh: 9,231; makefile: 176; cpp: 84; exp: 18
file content (18 lines) | stat: -rw-r--r-- 795 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* e_intmax.c:  Overflow of constant expression in #if directive.    */

/* { dg-do preprocess } */
/* { dg-options "-std=c99 -pedantic-errors -w" } */

#define	INTMAX_MAX	0x7FFFFFFFFFFFFFFF
#define INTMAX_MIN	(-INTMAX_MAX-1)
#define SHRT_MAX    0x7FFF

#if     INTMAX_MAX - INTMAX_MIN /* { dg-error "integer overflow in preprocessor expression| Result of \"-\" is out of range" } */
#endif
#if     INTMAX_MAX + 1 > SHRT_MAX   /* { dg-error "integer overflow in preprocessor expression| Result of \"\\+\" is out of range" } */
#endif
#if     INTMAX_MIN - 1  /* { dg-error "integer overflow in preprocessor expression| Result of \"-\" is out of range" } */
#endif
#if     INTMAX_MAX * 2  /* { dg-error "integer overflow in preprocessor expression| Result of \"\\*\" is out of range" } */
#endif