2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / f2c_4.c
blob7fb1debf31dbdc8483f72efce900464957d82e22
1 /* Check -ff2c calling conventions
2 Return value of COMPLEX function is via an extra argument in the
3 calling sequence that points to where to store the return value
4 Additional underscore appended to function name
6 Simplified from f2c output and tested with g77 */
8 /* We used to #include <complex.h>, but this fails for some platforms
9 (like cygwin) who don't have it yet. */
10 #define complex __complex__
11 #define _Complex_I (1.0iF)
13 typedef float real;
14 typedef double doublereal;
16 extern double f2c_4b__(double *);
17 extern void f2c_4d__( complex float *, complex float *);
18 extern void f2c_4f__( complex float *, int *,complex float *);
19 extern void f2c_4h__( complex double *, complex double *);
20 extern void f2c_4j__( complex double *, int *, complex double *);
21 extern void abort (void);
23 void f2c_4a__(void) {
24 double a,b;
25 a = 1023.0;
26 b=f2c_4b__(&a);
27 if ( a != b ) abort();
30 void f2c_4c__(void) {
31 complex float x,ret_val;
32 x = 1234 + 5678 * _Complex_I;
33 f2c_4d__(&ret_val,&x);
34 if ( x != ret_val ) abort();
37 void f2c_4e__(void) {
38 complex float x,ret_val;
39 int i=0;
40 x = 1234 + 5678 * _Complex_I;
41 f2c_4f__(&ret_val,&i,&x);
42 if ( x != ret_val ) abort();
45 void f2c_4g__(void) {
46 complex double x,ret_val;
47 x = 1234 + 5678.0f * _Complex_I;
48 f2c_4h__(&ret_val,&x);
49 if ( x != ret_val ) abort();
52 void f2c_4i__(void) {
53 complex double x,ret_val;
54 int i=0;
55 x = 1234.0f + 5678.0f * _Complex_I;
56 f2c_4j__(&ret_val,&i,&x);
57 if ( x != ret_val ) abort();
60 void f2c_4k__(complex float *ret_val, complex float *x) {
61 *ret_val = *x;
64 void f2c_4l__(complex float *ret_val, int *i, complex float *x) {
65 *ret_val = *x;
68 void f2c_4m__(complex double *ret_val, complex double *x) {
69 *ret_val = *x;
72 void f2c_4n__(complex double *ret_val, int *i, complex double *x) {
73 *ret_val = *x;