summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-13 11:26:09 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-13 11:26:09 +0000
commit3aca49a41ee1b38e688fb6e83dcc0c781bced980 (patch)
tree172207645fb43ac1cc1dd6ffa9e956cf1b3e54b4
parentab7d6892e5f06b52ae4280b427b92966f67b4d69 (diff)
downloadppe42-gcc-3aca49a41ee1b38e688fb6e83dcc0c781bced980.tar.gz
ppe42-gcc-3aca49a41ee1b38e688fb6e83dcc0c781bced980.zip
2007-04-13 Tobias Burnus <burnus@net-b.de>
PR fortran/31562 * gfortran.dg/f2c_4.c: Use GNU extensions for complex instead of a struct. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123784 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/f2c_4.c63
2 files changed, 35 insertions, 34 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7dfa74b26c4..215518516cc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,6 +1,12 @@
2007-04-13 Tobias Burnus <burnus@net-b.de>
PR fortran/31562
+ * gfortran.dg/f2c_4.c: Use GNU extensions for complex
+ instead of a struct.
+
+2007-04-13 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/31562
* gfortran.dg/value_4.c: Use GNU extensions for complex
instead of a struct.
diff --git a/gcc/testsuite/gfortran.dg/f2c_4.c b/gcc/testsuite/gfortran.dg/f2c_4.c
index 58f3ef1a2ab..7fb1debf31d 100644
--- a/gcc/testsuite/gfortran.dg/f2c_4.c
+++ b/gcc/testsuite/gfortran.dg/f2c_4.c
@@ -5,16 +5,19 @@
Simplified from f2c output and tested with g77 */
+/* 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)
+
typedef float real;
typedef double doublereal;
-typedef struct { real r, i; } complex;
-typedef struct { doublereal r, i; } doublecomplex;
extern double f2c_4b__(double *);
-extern void f2c_4d__( complex *, complex *);
-extern void f2c_4f__( complex *, int *,complex *);
-extern void f2c_4h__( doublecomplex *, doublecomplex *);
-extern void f2c_4j__( doublecomplex *, int *, doublecomplex *);
+extern void f2c_4d__( complex float *, complex float *);
+extern void f2c_4f__( complex float *, int *,complex float *);
+extern void f2c_4h__( complex double *, complex double *);
+extern void f2c_4j__( complex double *, int *, complex double *);
extern void abort (void);
void f2c_4a__(void) {
@@ -25,55 +28,47 @@ void f2c_4a__(void) {
}
void f2c_4c__(void) {
- complex x,ret_val;
- x.r = 1234;
- x.i = 5678;
+ complex float x,ret_val;
+ x = 1234 + 5678 * _Complex_I;
f2c_4d__(&ret_val,&x);
- if ( x.r != ret_val.r && x.i != ret_val.i ) abort();
+ if ( x != ret_val ) abort();
}
void f2c_4e__(void) {
- complex x,ret_val;
+ complex float x,ret_val;
int i=0;
- x.r = 1234;
- x.i = 5678;
+ x = 1234 + 5678 * _Complex_I;
f2c_4f__(&ret_val,&i,&x);
- if ( x.r != ret_val.r && x.i != ret_val.i ) abort();
+ if ( x != ret_val ) abort();
}
void f2c_4g__(void) {
- doublecomplex x,ret_val;
- x.r = 1234;
- x.i = 5678.0f;
+ complex double x,ret_val;
+ x = 1234 + 5678.0f * _Complex_I;
f2c_4h__(&ret_val,&x);
- if ( x.r != ret_val.r && x.i != ret_val.i ) abort();
+ if ( x != ret_val ) abort();
}
void f2c_4i__(void) {
- doublecomplex x,ret_val;
+ complex double x,ret_val;
int i=0;
- x.r = 1234.0f;
- x.i = 5678.0f;
+ x = 1234.0f + 5678.0f * _Complex_I;
f2c_4j__(&ret_val,&i,&x);
- if ( x.r != ret_val.r && x.i != ret_val.i ) abort();
+ if ( x != ret_val ) abort();
}
-void f2c_4k__(complex *ret_val, complex *x) {
- ret_val->r = x->r;
- ret_val->i = x->i;
+void f2c_4k__(complex float *ret_val, complex float *x) {
+ *ret_val = *x;
}
-void f2c_4l__(complex *ret_val, int *i, complex *x) {
- ret_val->r = x->r;
- ret_val->i = x->i;
+void f2c_4l__(complex float *ret_val, int *i, complex float *x) {
+ *ret_val = *x;
}
-void f2c_4m__(doublecomplex *ret_val, doublecomplex *x) {
- ret_val->r = x->r;
- ret_val->i = x->i;
+void f2c_4m__(complex double *ret_val, complex double *x) {
+ *ret_val = *x;
}
-void f2c_4n__(doublecomplex *ret_val, int *i, doublecomplex *x) {
- ret_val->r = x->r;
- ret_val->i = x->i;
+void f2c_4n__(complex double *ret_val, int *i, complex double *x) {
+ *ret_val = *x;
}
OpenPOWER on IntegriCloud