aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2007-03-04 19:44:24 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2007-03-04 19:44:24 +0100
commit3af836867fc2213cd3b93ced426ba2d5ffc55e9a (patch)
treefc25a5da4d64d103ca19e577e95bac39e2db0878
parent5ca09e73935c2c5a034fbe1786becc019bc44c64 (diff)
downloadgcc-3af836867fc2213cd3b93ced426ba2d5ffc55e9a.zip
gcc-3af836867fc2213cd3b93ced426ba2d5ffc55e9a.tar.gz
gcc-3af836867fc2213cd3b93ced426ba2d5ffc55e9a.tar.bz2
c_by_val.c: Use _Complex instead of a struct.
2007-03-04 Tobias Burnus <burnus@net-b.de> * gfortran.dg/c_by_val.c: Use _Complex instead of a struct. From-SVN: r122530
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/c_by_val.c35
2 files changed, 17 insertions, 22 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5b717af..13e8447 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2007-03-04 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/c_by_val.c: Use _Complex instead of a struct.
+
2007-03-04 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR target/30406
diff --git a/gcc/testsuite/gfortran.dg/c_by_val.c b/gcc/testsuite/gfortran.dg/c_by_val.c
index 78bf0ef..9835769 100644
--- a/gcc/testsuite/gfortran.dg/c_by_val.c
+++ b/gcc/testsuite/gfortran.dg/c_by_val.c
@@ -1,15 +1,14 @@
/* Passing from fortran to C by value, using %VAL. */
#include <inttypes.h>
+#include <complex.h>
-typedef struct { float r, i; } complex;
-typedef struct { double r, i; } complex8;
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*, complex, complex*, complex**);
-extern void c_to_c8__ (complex8*, complex8, complex8*, complex8**);
+extern void c_to_c__ (float _Complex*, float _Complex, float _Complex*, float _Complex**);
+extern void c_to_c8__ (double _Complex*, double _Complex, double _Complex*, double _Complex**);
extern void abort (void);
void
@@ -53,29 +52,21 @@ i_to_i8__(int64_t *retval, int64_t i1, int64_t *i2, int64_t **i3)
}
void
-c_to_c__(complex *retval, complex c1, complex *c2, complex **c3)
+c_to_c__(float _Complex *retval, float _Complex c1, float _Complex *c2, float _Complex **c3)
{
- if ( c1.r != c2->r ) abort();
- if ( c1.i != c2->i ) abort();
- if ( c1.r != (*c3)->r ) abort();
- if ( c1.i != (*c3)->i ) abort();
- c1.r = 0.0;
- c1.i = 0.0;
- retval->r = c2->r * 4.0;
- retval->i = c2->i * 4.0;
+ if ( c1 != *c2 ) abort();
+ if ( c1 != *(*c3) ) abort();
+ c1 = 0.0 + 0.0 * _Complex_I;
+ *retval = (*c2) * 4.0;
return;
}
void
-c_to_c8__(complex8 *retval, complex8 c1, complex8 *c2, complex8 **c3)
+c_to_c8__(double _Complex *retval, double _Complex c1, double _Complex *c2, double _Complex **c3)
{
- if ( c1.r != c2->r ) abort();
- if ( c1.i != c2->i ) abort();
- if ( c1.r != (*c3)->r ) abort();
- if ( c1.i != (*c3)->i ) abort();
- c1.r = 0.0;
- c1.i = 0.0;
- retval->r = c2->r * 4.0;
- retval->i = c2->i * 4.0;
+ if ( c1 != *c2 ) abort();
+ if ( c1 != *(*c3) ) abort();
+ c1 = 0.0 + 0.0 * _Complex_I;;
+ *retval = (*c2) * 4.0;
return;
}