URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
298 |
jeremybenn |
/* PR 23572 : warnings for out of range floating-point constants
|
2 |
|
|
Test that they are NOT pedantic warnings. */
|
3 |
|
|
/* { dg-compile } */
|
4 |
|
|
/* { dg-options "-pedantic-errors -std=c99" } */
|
5 |
|
|
/* { dg-skip-if "No Inf support" { spu-*-* } } */
|
6 |
|
|
#include <math.h>
|
7 |
|
|
|
8 |
|
|
#ifndef INFINITY
|
9 |
|
|
#define INFINITY (__builtin_inff ())
|
10 |
|
|
#endif
|
11 |
|
|
|
12 |
|
|
void overflow(void)
|
13 |
|
|
{
|
14 |
|
|
float f1 = 3.5E+38f; /* { dg-warning "floating constant exceeds range" } */
|
15 |
|
|
float f2 = -3.5E+38f; /* { dg-warning "floating constant exceeds range" } */
|
16 |
|
|
float f3 = INFINITY;
|
17 |
|
|
float f4 = -INFINITY;
|
18 |
|
|
|
19 |
|
|
double d1 = 1.9E+308; /* { dg-warning "floating constant exceeds range" } */
|
20 |
|
|
double d2 = -1.9E+308; /* { dg-warning "floating constant exceeds range" } */
|
21 |
|
|
double d3 = INFINITY;
|
22 |
|
|
double d4 = -INFINITY;
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
void underflow(void)
|
26 |
|
|
{
|
27 |
|
|
float f11 = 3.3E-10000000000000000000f; /* { dg-warning "floating constant truncated to zero" } */
|
28 |
|
|
float f22 = -3.3E-10000000000000000000f; /* { dg-warning "floating constant truncated to zero" } */
|
29 |
|
|
float f1 = 3.3E-46f; /* { dg-warning "floating constant truncated to zero" } */
|
30 |
|
|
float f2 = -3.3E-46f; /* { dg-warning "floating constant truncated to zero" } */
|
31 |
|
|
float f3 = 0;
|
32 |
|
|
float f4 = -0;
|
33 |
|
|
float f5 = 0.0;
|
34 |
|
|
float f6 = -0.0;
|
35 |
|
|
|
36 |
|
|
double d11 = 3.3E-10000000000000000000; /* { dg-warning "floating constant truncated to zero" } */
|
37 |
|
|
double d22 = -3.3E-10000000000000000000; /* { dg-warning "floating constant truncated to zero" } */
|
38 |
|
|
double d1 = 1.4E-325; /* { dg-warning "floating constant truncated to zero" } */
|
39 |
|
|
double d2 = -1.4E-325; /* { dg-warning "floating constant truncated to zero" } */
|
40 |
|
|
double d3 = 0;
|
41 |
|
|
double d4 = -0;
|
42 |
|
|
double d5 = 0.0;
|
43 |
|
|
double d6 = -0.0;
|
44 |
|
|
}
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.