OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [c-c++-common/] [Wconversion-real.c] - Blame information for rev 295

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 295 jeremybenn
/* Test for diagnostics for Wconversion for floating-point.  */
2
 
3
/* { dg-do compile } */
4
/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
5
/* { dg-options "-std=c99 -Wconversion" { target c } } */
6
/* { dg-options "-Wconversion" { target c++ } } */
7
/* { dg-require-effective-target large_double } */
8
 
9
float  vfloat;
10
double vdouble;
11
long double vlongdouble;
12
 
13
void ffloat (float f);
14
void fdouble (double d);
15
void flongdouble (long double ld);
16
 
17
void h (void)
18
{
19
  float f = 0;
20
  double d = 0;
21
  long double ld = 0;
22
 
23
  ffloat (3.1); /* { dg-warning "conversion" } */
24
  vfloat = 3.1; /* { dg-warning "conversion" } */
25
  ffloat (3.1L); /* { dg-warning "conversion" } */
26
  vfloat = 3.1L;  /* { dg-warning "conversion" } */
27
  fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
28
  vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
29
  ffloat (vdouble); /* { dg-warning "conversion" } */
30
  vfloat = vdouble; /* { dg-warning "conversion" } */
31
  ffloat (vlongdouble); /* { dg-warning "conversion" } */
32
  vfloat = vlongdouble; /* { dg-warning "conversion" } */
33
  fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
34
  vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
35
 
36
 
37
  ffloat ((float) 3.1);
38
  vfloat = (float) 3.1;
39
  ffloat ((float) 3.1L);
40
  vfloat = (float) 3.1L;
41
  fdouble ((double) 3.1L);
42
  vdouble = (double) 3.1L;
43
  ffloat ((float) vdouble);
44
  vfloat = (float) vdouble;
45
  ffloat ((float) vlongdouble);
46
  vfloat = (float) vlongdouble;
47
  fdouble ((double) vlongdouble);
48
  vdouble = (double) vlongdouble;
49
 
50
 
51
  ffloat (3.0);
52
  vfloat = 3.0;
53
  ffloat (3.1f);
54
  vfloat = 3.1f;
55
  ffloat (0.25L);
56
  vfloat = 0.25L;
57
 
58
 
59
  fdouble (3.0);
60
  vdouble = 3.0;
61
  fdouble (3.1f);
62
  vdouble = 3.1f;
63
  fdouble (0.25L);
64
  vdouble = 0.25L;
65
 
66
  flongdouble (3.0);
67
  vlongdouble = 3.0;
68
  flongdouble (3.1f);
69
  vlongdouble = 3.1f;
70
  flongdouble (0.25L);
71
  vlongdouble = 0.25L;
72
 
73
  ffloat (f);
74
  vfloat = f;
75
  fdouble (f);
76
  vdouble = f;
77
  fdouble (d);
78
  vdouble = d;
79
  flongdouble (f);
80
  vlongdouble = f;
81
  flongdouble (d);
82
  vlongdouble = d;
83
  flongdouble (ld);
84
  vlongdouble = ld;
85
}

powered by: WebSVN 2.1.0

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