public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, fortran testsuite]: Correct the calls to c functions in gfortran.dg/c_by_val_1.f
@ 2016-09-01 19:11 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2016-09-01 19:11 UTC (permalink / raw)
  To: gcc-patches; +Cc: Fortran List

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

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.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 907 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-01 19:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 19:11 [PATCH, fortran testsuite]: Correct the calls to c functions in gfortran.dg/c_by_val_1.f Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).