OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [c90-const-expr-8.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test for constant expressions: overflow and constant expressions
2
   with -fwrapv: overflows still count as such for the purposes of
3
   constant expressions even when they have defined values at
4
   runtime.  */
5
/* Origin: Joseph Myers <joseph@codesourcery.com> */
6
/* { dg-do compile } */
7
/* { dg-options "-std=iso9899:1990 -pedantic-errors -fwrapv" } */
8
 
9
#include <limits.h>
10
 
11
enum e {
12
  E0 = 0 * (INT_MAX + 1), /* { dg-warning "21:integer overflow in expression" } */
13
  /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 12 } */
14
  E1 = 0 * (INT_MIN / -1), /* { dg-warning "21:integer overflow in expression" } */
15
  /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 14 } */
16
  E2 = 0 * (INT_MAX * INT_MAX), /* { dg-warning "21:integer overflow in expression" } */
17
  /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 16 } */
18
  E3 = 0 * (INT_MIN - 1), /* { dg-warning "21:integer overflow in expression" } */
19
  /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 18 } */
20
  E4 = 0 * (unsigned)(INT_MIN - 1), /* { dg-warning "31:integer overflow in expression" } */
21
  /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 20 } */
22
  E5 = 0 * -INT_MIN, /* { dg-warning "12:integer overflow in expression" } */
23
  /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 22 } */
24
  E6 = 0 * !-INT_MIN, /* { dg-warning "13:integer overflow in expression" } */
25
  /* { dg-error "3:not an integer constant" "constant" { target *-*-* } 24 } */
26
  E7 = INT_MIN % -1 /* Not an overflow.  */
27
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.