diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/c_by_val.c | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/c_by_val.c')
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_by_val.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_by_val.c b/gcc/testsuite/gfortran.dg/c_by_val.c new file mode 100644 index 000000000..617668619 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_by_val.c @@ -0,0 +1,76 @@ +/* Passing from fortran to C by value, using %VAL. */ + +#include <inttypes.h> + +/* We used to #include <complex.h>, but this fails for some platforms + (like cygwin) who don't have it yet. */ +#define complex __complex__ +#define _Complex_I (1.0iF) + +extern void f_to_f__ (float*, float, float*, float**); +extern void f_to_f8__ (double*, double, double*, double**); +extern void i_to_i__ (int*, int, int*, int**); +extern void i_to_i8__ (int64_t*, int64_t, int64_t*, int64_t**); +extern void c_to_c__ (complex float*, complex float, complex float*, complex float**); +extern void c_to_c8__ (complex double*, complex double, complex double*, complex double**); +extern void abort (void); + +void +f_to_f__(float *retval, float a1, float *a2, float **a3) +{ + if ( a1 != *a2 ) abort(); + if ( a1 != **a3 ) abort(); + a1 = 0.0; + *retval = *a2 * 2.0; + return; +} + +void +f_to_f8__(double *retval, double a1, double *a2, double **a3) +{ + if ( a1 != *a2 ) abort(); + if ( a1 != **a3 ) abort(); + a1 = 0.0; + *retval = *a2 * 2.0; + return; +} + +void +i_to_i__(int *retval, int i1, int *i2, int **i3) +{ + if ( i1 != *i2 ) abort(); + if ( i1 != **i3 ) abort(); + i1 = 0; + *retval = *i2 * 3; + return; +} + +void +i_to_i8__(int64_t *retval, int64_t i1, int64_t *i2, int64_t **i3) +{ + if ( i1 != *i2 ) abort(); + if ( i1 != **i3 ) abort(); + i1 = 0; + *retval = *i2 * 3; + return; +} + +void +c_to_c__(complex float *retval, complex float c1, complex float *c2, complex float **c3) +{ + if ( c1 != *c2 ) abort(); + if ( c1 != *(*c3) ) abort(); + c1 = 0.0 + 0.0 * _Complex_I; + *retval = (*c2) * 4.0; + return; +} + +void +c_to_c8__(complex double *retval, complex double c1, complex double *c2, complex double **c3) +{ + if ( c1 != *c2 ) abort(); + if ( c1 != *(*c3) ) abort(); + c1 = 0.0 + 0.0 * _Complex_I;; + *retval = (*c2) * 4.0; + return; +} |