diff mbox

[fortran,testsuite] : Correct the calls to c functions in gfortran.dg/c_by_val_1.f

Message ID CAFULd4YAkNCgyZterufe+ED=WsCHuJKLQVHi9cY9VtGo8zCtXg@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 1, 2016, 7:11 p.m. UTC
Hello!

Functions c_to_c__ and c_to_c8__ in the supplemental testcase c file
are prototyped as:

extern void c_to_c__ (complex float*, complex float, complex float*,
complex float**);
extern void c_to_c8__ (complex double*, complex double, complex
double*, complex double**);

so, we have to call them according to their prototypes from the fortran source.

2016-09-01  Uros Bizjak  <ubizjak@gmail.com>

    * gfortran.dg/c_by_val_1.f: Correct the call to c_to_c and c_to_c8.

Tested on x86_64-linux-gnu {,-m32}  and alphaev68-linux-gnu.

BTW: The testcase works by accident. When compiling the testcase, the
fortran compiler declares half of the arguments to these two functions
as unnamed (aka variable arguments), and the testcase fails on targets
that handle named and unnamed arguments in a different way.

OK for mainline and release branches?

Uros.
diff mbox

Patch

Index: gfortran.dg/c_by_val_1.f
===================================================================
--- gfortran.dg/c_by_val_1.f	(revision 239943)
+++ gfortran.dg/c_by_val_1.f	(working copy)
@@ -9,8 +9,8 @@ 
       real(8)    a8, b8, c8
       integer(4) i, j, k
       integer(8) i8, j8, k8
-      complex    u, v, w, c_to_c
-      complex(8) u8, v8, w8, c_to_c8
+      complex    u, v, w
+      complex(8) u8, v8, w8
 
       a = 42.0
       b = 0.0
@@ -39,13 +39,13 @@ 
       u = (-1.0, 2.0)
       v = (1.0, -2.0)
       w = u
-      v = c_to_c (%VAL (u), %REF (w), %LOC (w))
+      call c_to_c (v, %VAL (u), %REF (w), %LOC (w))
       if ((4.0 * u).ne.v) call abort ()
 
       u8 = (-1.0, 2.0)
       v8 = (1.0, -2.0)
       w8 = u8
-      v8 = c_to_c8 (%VAL (u8), %REF (w8), %LOC (w8))
+      call c_to_c8 (v8, %VAL (u8), %REF (w8), %LOC (w8))
       if ((4.0 * u8).ne.v8) call abort ()
 
       stop