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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [c-c++-common/] [dfp/] [convert-int-saturate.c] - Blame information for rev 686

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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