re PR fortran/31562 (FAIL: gfortran.dg/value_4.f90 -O0 execution test)
authorTobias Burnus <burnus@net-b.de>
Fri, 13 Apr 2007 10:59:19 +0000 (12:59 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Fri, 13 Apr 2007 10:59:19 +0000 (12:59 +0200)
2007-04-12  Tobias Burnus  <burnus@net-b.de>

       PR fortran/31562
       * gfortran.dg/value_4.c: Use GNU extensions for complex
       instead of a struct.

From-SVN: r123780

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/value_4.c

index 53aed21..023fc9b 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-12  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/31562
+       * gfortran.dg/value_4.c: Use GNU extensions for complex
+       instead of a struct.
+
 2007-04-13  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/21258
index 1eff965..a9f9aae 100644 (file)
@@ -3,10 +3,14 @@
 
     Contributed by Paul Thomas <pault@gcc.gnu.org>  */
 
-typedef struct { float r, i; } complex;
+/* 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 float *f_to_f__ (float, float*);
 extern int *i_to_i__ (int, int*);
-extern void c_to_c__ (complex*, complex, complex*);
+extern void c_to_c__ (complex float*, complex float, complex float*);
 extern void abort (void);
 
 /* In f_to_f and i_to_i we return the second argument, so that we do
@@ -35,14 +39,11 @@ i_to_i__(int i1, int *i2)
 }
 
 void
-c_to_c__(complex *retval, complex c1, complex *c2)
+c_to_c__(complex float *retval, complex float c1, complex float *c2)
 {
-  if ( c1.r != c2->r ) abort();
-  if ( c1.i != c2->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();
+  c1 = 0.0 + 0.0 * _Complex_I;
+  *retval = *c2 * 4.0;
   return;
 }