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

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [cast-function-1.c] - Blame information for rev 645

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

Line No. Rev Author Line
1 149 jeremybenn
/* PR c/12085 */
2
/* Origin: David Hollenberg <dhollen@mosis.org> */
3
 
4
/* Verify that the compiler doesn't inline a function at
5
   a calling point where it is viewed with a different
6
   prototype than the actual one.  */
7
 
8
/* { dg-do compile } */
9
/* { dg-options "-O3" } */
10
 
11
int foo1(int);
12
int foo2();
13
 
14
typedef struct {
15
  double d;
16
  int a;
17
} str_t;
18
 
19
void bar(void)
20
{
21
  double d;
22
  int i;
23
  str_t s;
24
 
25
  d = ((double (*) (int)) foo1) (i);  /* { dg-warning "non-compatible|abort" } */
26
  i = ((int (*) (double)) foo1) (d);  /* { dg-warning "non-compatible|abort" } */
27
  s = ((str_t (*) (int)) foo1) (i);   /* { dg-warning "non-compatible|abort" } */
28
  ((void (*) (int)) foo1) (d);        /* { dg-warning "non-compatible|abort" } */
29
  i = ((int (*) (int)) foo1) (i);     /* { dg-bogus "non-compatible|abort" } */
30
  (void) foo1 (i);                    /* { dg-bogus "non-compatible|abort" } */
31
 
32
  d = ((double (*) (int)) foo2) (i);  /* { dg-warning "non-compatible|abort" } */
33
  i = ((int (*) (double)) foo2) (d);  /* { dg-bogus "non-compatible|abort" } */
34
  s = ((str_t (*) (int)) foo2) (i);   /* { dg-warning "non-compatible|abort" } */
35
  ((void (*) (int)) foo2) (d);        /* { dg-warning "non-compatible|abort" } */
36
  i = ((int (*) (int)) foo2) (i);     /* { dg-bogus "non-compatible|abort" } */
37
  (void) foo2 (i);                    /* { dg-bogus "non-compatible|abort" } */
38
}
39
 
40
int foo1(int arg)
41
{
42
  return arg;
43
}
44
 
45
int foo2(arg)
46
  int arg;
47
{
48
  return arg;
49
}

powered by: WebSVN 2.1.0

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