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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [wtr-int-type-1.c] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test for -Wtraditional warnings on integer constant types.
2
   Note, gcc should omit these warnings in system header files.
3
   By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
4
/* { dg-do compile } */
5
/* { dg-options "-std=c99 -Wtraditional" } */
6
 
7
void
8
testfunc ()
9
{
10
  long long i;
11
 
12
  /* Octal and hex values shouldn't issue -Wtraditional warnings. */
13
  i = 0x80000000;
14
  i = 0xFFFFFFFF;
15
  i = 037777777777;
16
 
17
  i = 0x8000000000000000;
18
  i = 0xFFFFFFFFFFFFFFFF;
19
  i = 01777777777777777777777;
20
 
21
  /* Nor should values outside the range of (32-bit) unsigned long but
22
     inside the range of long long.  [since -traditional has no long long,
23
     we can pretend it worked the way it does in C99.]  */
24
  i = 9223372036854775807;
25
 
26
  /* But this one should, since it doesn't fit in long (long), but
27
     does fit in unsigned long (long).  */
28
  i = 18446744073709551615; /* { dg-warning "integer constant is so large that it is unsigned" "decimal constant" } */
29
  /* { dg-warning "this decimal constant would be unsigned in ISO C90" "decimal constant" { target *-*-* } 28 } */
30
 
31
# 29 "sys-header.h" 3
32
}
33
 
34
void
35
testfunc2( )
36
{
37
  long long i;
38
 
39
/* We are in system headers now, no -Wtraditional warnings should issue.  */
40
 
41
  i = 0x80000000;
42
  i = 0xFFFFFFFF;
43
  i = 037777777777;
44
 
45
  i = 0x8000000000000000;
46
  i = 0xFFFFFFFFFFFFFFFF;
47
  i = 01777777777777777777777;
48
 
49
  i = 9223372036854775807;
50
  i = 18446744073709551615;
51
}
52
 

powered by: WebSVN 2.1.0

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