This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, committed, Fortran] Fix gfortran.dg/value_4.c and gfortran.dg/f2c_4.c (PR31562)


This fixes the test-suite failures on powerpc-suse-linux as reported by
Andreas Schwab in PR31562.

similarly to c_by_val.c we have to change "struct complex" into C99
"complex" to get it pass.

the first patch was approved by FX in PR 31562 and works with 32 and 64
bit on powerpc-suse-linux as tested by Andreas.

The second patch I committed as obvious and is only tested on
x86-64/Linux but does the analogous thing.
Thanks for FX and Tobias S for pointing out.

Tobias

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 123778)
+++ ChangeLog   (revision 123784)
@@ -1,3 +1,15 @@
+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.
+
 2007-04-13  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/21258
@@ -12,6 +24,8 @@

        PR fortran/31250
        * gfortran.dg/char_length_2.f90: New.
+       * gfortran.dg/repeat_2.f90: Add dg-warning annotations.
+       * gfortran.dg/repeat_4.f90: Likewise.

        PR fortran/31266
        * gfortran.dg/char_assign_1.f90: New.
Index: gfortran.dg/value_4.c
===================================================================
--- gfortran.dg/value_4.c       (revision 123778)
+++ gfortran.dg/value_4.c       (revision 123784)
@@ -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 @@
 }

 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;
 }



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]