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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [convert-int-saturate.c] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-std=gnu99" } */
2
 
3
/* N1150 5.1 Conversion between decimal floating integer.
4
   C99 6.3.1.4(1a) New.
5
   Test integer saturation.  */
6
 
7
#include <decfloat.h>
8
#include <limits.h>
9
 
10
extern void abort (void);
11
 
12
volatile _Decimal32 d32;
13
volatile _Decimal64 d64;
14
volatile _Decimal128 d128;
15
 
16
volatile signed int si;
17
volatile unsigned int usi;
18
volatile unsigned long long udi;
19
 
20
int
21
main ()
22
{
23
 
24
  /* Unsigned.  */
25
  usi = DEC32_MAX;  /* { dg-warning "overflow in implicit constant conversion" } */
26
  if (usi != UINT_MAX)
27
    abort ();
28
 
29
  usi = DEC64_MAX;  /* { dg-warning "overflow in implicit constant conversion" } */
30
  if (usi != UINT_MAX)
31
    abort ();
32
 
33
  usi = DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
34
  if (usi != UINT_MAX)
35
    abort ();
36
 
37
  /* Signed.  */
38
  si = DEC32_MAX;       /* { dg-warning "overflow in implicit constant conversion" } */
39
  if (si != INT_MAX)
40
    abort ();
41
 
42
  si = DEC64_MAX;   /* { dg-warning "overflow in implicit constant conversion" } */
43
  if (si != INT_MAX)
44
    abort ();
45
 
46
  si = DEC128_MAX;  /* { dg-warning "overflow in implicit constant conversion" } */
47
  if (si != INT_MAX)
48
    abort ();
49
 
50
  si = - DEC32_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
51
  if (si != INT_MIN)
52
    abort ();
53
 
54
  si = - DEC64_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
55
  if (si != INT_MIN)
56
    abort ();
57
 
58
  si = - DEC128_MAX; /* { dg-warning "overflow in implicit constant conversion" } */
59
  if (si != INT_MIN)
60
    abort ();
61
 
62
  return 0;
63
}

powered by: WebSVN 2.1.0

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