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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [value_4.c] - Blame information for rev 316

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

Line No. Rev Author Line
1 302 jeremybenn
/*  Passing from fortran to C by value, using VALUE.  This is identical
2
    to c_by_val_1.c, which performs the same function for %VAL.
3
 
4
    Contributed by Paul Thomas <pault@gcc.gnu.org>  */
5
 
6
/* We used to #include <complex.h>, but this fails for some platforms
7
   (like cygwin) who don't have it yet.  */
8
#define complex __complex__
9
#define _Complex_I (1.0iF)
10
 
11
extern float *f_to_f__ (float, float*);
12
extern int *i_to_i__ (int, int*);
13
extern void c_to_c__ (complex float*, complex float, complex float*);
14
extern void abort (void);
15
 
16
/* In f_to_f and i_to_i we return the second argument, so that we do
17
   not have to worry about keeping track of memory allocation between
18
   fortran and C.  All three functions check that the argument passed
19
   by value is the same as that passed by reference.  Then the passed
20
   by value argument is modified so that the caller can check that
21
   its version has not changed.*/
22
 
23
float *
24
f_to_f__(float a1, float *a2)
25
{
26
  if ( a1 != *a2 ) abort();
27
  *a2 = a1 * 2.0;
28
  a1 = 0.0;
29
  return a2;
30
}
31
 
32
int *
33
i_to_i__(int i1, int *i2)
34
{
35
  if ( i1 != *i2 ) abort();
36
  *i2 = i1 * 3;
37
  i1 = 0;
38
  return i2;
39
}
40
 
41
void
42
c_to_c__(complex float *retval, complex float c1, complex float *c2)
43
{
44
  if ( c1 != *c2 ) abort();
45
  c1 = 0.0 + 0.0 * _Complex_I;
46
  *retval = *c2 * 4.0;
47
  return;
48
}
49
 

powered by: WebSVN 2.1.0

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