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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [struct-ret-1.c] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
#include <stdio.h>
2
#include <string.h>
3
 
4
char out[100];
5
 
6
typedef struct { double d; int i[3]; } B;
7
typedef struct { char c[33],c1; } X;
8
 
9
char c1 = 'a';
10
char c2 = 127;
11
char c3 = (char)128;
12
char c4 = (char)255;
13
char c5 = -1;
14
 
15
double d1 = 0.1;
16
double d2 = 0.2;
17
double d3 = 0.3;
18
double d4 = 0.4;
19
double d5 = 0.5;
20
double d6 = 0.6;
21
double d7 = 0.7;
22
double d8 = 0.8;
23
double d9 = 0.9;
24
 
25
B B1 = {0.1,{1,2,3}};
26
B B2 = {0.2,{5,4,3}};
27
X X1 = {"abcdefghijklmnopqrstuvwxyzABCDEF", 'G'};
28
X X2 = {"123",'9'};
29
X X3 = {"return-return-return",'R'};
30
 
31
X f (B a, char b, double c, B d)
32
{
33
  static X xr = {"return val", 'R'};
34
  X r;
35
  r = xr;
36
  r.c1 = b;
37
  sprintf (out, "X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})",
38
           a.d, a.i[0], a.i[1], a.i[2], b, c, d.d, d.i[0], d.i[1], d.i[2]);
39
  return r;
40
}
41
 
42
X (*fp) (B, char, double, B) = &f;
43
 
44
main ()
45
{
46
  X Xr;
47
  char tmp[100];
48
 
49
  Xr = f (B1, c2, d3, B2);
50
  strcpy (tmp, out);
51
  Xr.c[0] = Xr.c1 = '\0';
52
  Xr = (*fp) (B1, c2, d3, B2);
53
  if (strcmp (tmp, out))
54
    abort ();
55
 
56
  exit (0);
57
}

powered by: WebSVN 2.1.0

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