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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.warn/] [impint.C] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do assemble  }
2
// { dg-options "-Wconversion" }
3
// Copyright (C) 2000 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 24 Feb 2000 
5
 
6
// derived from a bug report by Johan Kuipers 
7
// initialization to 'int' from to 'double' We expect consistent warnings
8
// whenever a float is implicitly truncated to int
9
 
10
struct X
11
{
12
  X (int);
13
  X (int, int);
14
};
15
 
16
void foo (int);
17
void wibble (int);
18
void wibble (int, int);
19
void punk (int = 3.5);
20
void rock ();
21
void rock (int, int = 3.5);
22
 
23
void fn ()
24
{
25
  X x1(3.5);        // { dg-warning "" } double to int
26
  X x2(3.5f);       // { dg-warning "" } float to int
27
  X x3(1, 3.5);     // { dg-warning "" } double to int
28
  X x4(1, 3.5f);    // { dg-warning "" } float to int
29
  X x5(3.5, 1);     // { dg-warning "" } double to int
30
  X x6(3.5f, 1);    // { dg-warning "" } float to int
31
 
32
  X y1 = 3.5;       // { dg-warning "" } double to int
33
  X y2 = 3.5f;      // { dg-warning "" } float to int
34
 
35
  int j1 (3.5);     // { dg-warning "" } double to int
36
  int j2 (3.5f);    // { dg-warning "" } float to int
37
 
38
  int k1 = 3.5;     // { dg-warning "" } double to int
39
  int k2 = 3.5f;    // { dg-warning "" } float to int
40
 
41
  j1 = 3.5;         // { dg-warning "" } double to int
42
  j2 = 3.5f;        // { dg-warning "" } float to int
43
 
44
  foo (3.5);        // { dg-warning "" } double to int
45
  foo (3.5f);       // { dg-warning "" } float to int
46
 
47
  wibble (3.5);     // { dg-warning "" } double to int
48
  wibble (3.5f);    // { dg-warning "" } float to int
49
  wibble (1, 3.5);  // { dg-warning "" } double to int
50
  wibble (1, 3.5f); // { dg-warning "" } float to int
51
  wibble (3.5, 1);  // { dg-warning "" } double to int
52
  wibble (3.5f, 1); // { dg-warning "" } float to int
53
 
54
  punk ();          // { dg-warning "" } double to int
55
  rock (1);         // { dg-warning "" } double to int
56
}

powered by: WebSVN 2.1.0

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