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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c90-intprom-1.c] - Blame information for rev 713

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for integer promotion rules: C90 subset of types.  */
2
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
3
/* { dg-do compile } */
4
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
5
 
6
#include <limits.h>
7
 
8
#define CHECK(T1, T2, TC)                       \
9
  do {                                          \
10
    T1 a = 0;                                    \
11
    T2 b = 0;                                    \
12
    TC *c = 0;                                   \
13
    __typeof__(a+b) *d = 0;                      \
14
    c = d;                                      \
15
    d = c;                                      \
16
  } while (0)
17
 
18
void
19
f (void)
20
{
21
  /* One type is unsigned long.  */
22
  CHECK(unsigned long, unsigned long, unsigned long);
23
  CHECK(unsigned int, unsigned long, unsigned long);
24
  CHECK(unsigned long, unsigned int, unsigned long);
25
  CHECK(int, unsigned long, unsigned long);
26
  CHECK(long, unsigned long, unsigned long);
27
  CHECK(unsigned long, int, unsigned long);
28
  CHECK(unsigned long, long, unsigned long);
29
  /* long and unsigned int.  */
30
#if LONG_MAX >= UINT_MAX
31
  CHECK(unsigned int, long, long);
32
  CHECK(long, unsigned int, long);
33
#else
34
  CHECK(unsigned int, long, unsigned long);
35
  CHECK(long, unsigned int, unsigned long);
36
#endif
37
  /* One type is long.  */
38
  CHECK(long, long, long);
39
  CHECK(int, long, long);
40
  CHECK(long, int, long);
41
  /* One type is unsigned int.  */
42
  CHECK(unsigned int, unsigned int, unsigned int);
43
  CHECK(int, unsigned int, unsigned int);
44
  CHECK(unsigned int, int, unsigned int);
45
  /* Otherwise int.  */
46
  CHECK(int, int, int);
47
}

powered by: WebSVN 2.1.0

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