URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
298 |
jeremybenn |
#include <limits.h>
|
2 |
|
|
|
3 |
|
|
void foo (int j)
|
4 |
|
|
{
|
5 |
|
|
int i1 = (int)(double)1.0 + INT_MAX; /* { dg-warning "integer overflow" } */
|
6 |
|
|
int i2 = (int)(double)1 + INT_MAX; /* { dg-warning "integer overflow" } */
|
7 |
|
|
int i3 = 1 + INT_MAX; /* { dg-warning "integer overflow" } */
|
8 |
|
|
int i4 = +1 + INT_MAX; /* { dg-warning "integer overflow" } */
|
9 |
|
|
int i5 = (int)((double)1.0 + INT_MAX);
|
10 |
|
|
int i6 = (double)1.0 + INT_MAX; /* { dg-warning "overflow in implicit constant" } */
|
11 |
|
|
int i7 = 0 ? (int)(double)1.0 + INT_MAX : 1;
|
12 |
|
|
int i8 = 1 ? 1 : (int)(double)1.0 + INT_MAX;
|
13 |
|
|
int i9 = j ? (int)(double)1.0 + INT_MAX : 1; /* { dg-warning "integer overflow" } */
|
14 |
|
|
unsigned int i10 = 0 ? (int)(double)1.0 + INT_MAX : 9U;
|
15 |
|
|
unsigned int i11 = 1 ? 9U : (int)(double)1.0 + INT_MAX;
|
16 |
|
|
unsigned int i12 = j ? (int)(double)1.0 + INT_MAX : 9U; /* { dg-warning "integer overflow" } */
|
17 |
|
|
int i13 = 1 || (int)(double)1.0 + INT_MAX < 0;
|
18 |
|
|
int i14 = 0 && (int)(double)1.0 + INT_MAX < 0;
|
19 |
|
|
int i15 = 0 || (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
|
20 |
|
|
int i16 = 1 && (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
|
21 |
|
|
int i17 = j || (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
|
22 |
|
|
int i18 = j && (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
|
23 |
|
|
}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.