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} Using dg-additional-sources in gfortran testsuite


This patch allows the use of dg-additional-sources in the
gfortran testsuite.  There are also two tests of mixed 
C and Fortran as examples.  Tested on i686-pc-cygwin.

OK for 4.1?  Do we add these to 4.0 as well?

2005-06-05  David Billinghurst  <David.Billinghurst@riotinto.com>

	* lib/gfortran.exp (gfortran_target_compile): 
	Call dg-additional-files-options
	* gfortran.dg/f2c_4.f90: New file
	* gfortran.dg/f2c_4.c: New file
	* gfortran.dg/f2c_5.f90: New file
	* gfortran.dg/f2c_5.c: New file


--- lib/gfortran.exp.orig       2005-06-05 22:23:39.849868800 +1000
+++ lib/gfortran.exp    2005-06-03 23:38:12.833660800 +1000
@@ -188,6 +188,6 @@
     lappend options "compiler=$GFORTRAN_UNDER_TEST"
 
     set options [concat "$ALWAYS_GFORTRANFLAGS" $options]
-
+    set options [dg-additional-files-options $options $source]
     return [target_compile $source $dest $type $options]
 }

--- /dev/null   2005-06-05 22:25:04.291289600 +1000
+++ gfortran.dg/f2c_4.f90       2005-06-05 21:32:25.198737600 +1000
@@ -0,0 +1,14 @@
+! { dg-do run }
+! { dg-additional-sources f2c_4.c }
+! { dg-options "-ff2c -w" }
+
+! Check -ff2c calling conventions
+!   Return value of REAL function is promoted to C type double
+!   Addional underscore appended to function name  
+call f2c_4a()
+end
+
+real function f2c_4b(x)
+  double precision x
+  f2c_4b = x
+end


--- /dev/null   2005-06-05 22:25:21.125496000 +1000
+++ gfortran.dg/f2c_4.c 2005-06-05 21:34:28.355828800 +1000
@@ -0,0 +1,9 @@
+extern double f2c_4b__(double *);
+extern void abort (void);
+
+void f2c_4a__(void) {
+  double a,b;
+  a = 1023.0;
+  b=f2c_4b__(&a);
+  if ( a != b ) abort();
+}

--- /dev/null   2005-06-05 22:25:38.941113600 +1000
+++ gfortran.dg/f2c_5.f90       2005-06-05 21:53:40.973211200 +1000
@@ -0,0 +1,12 @@
+! { dg-do run }
+! { dg-additional-sources f2c_5.c }
+! { dg-options "-fno-f2c" }
+
+! Check calling conventions without -ff2c
+program f2c_5  
+  call f2c_5a()
+end
+
+real function f2c_5b(x)
+  double precision x
+  f2c_5b = x
+end

--- /dev/null   2005-06-05 22:25:51.919776000 +1000
+++ gfortran.dg/f2c_5.c 2005-06-05 21:34:16.548851200 +1000
@@ -0,0 +1,9 @@
+extern float f2c_5b_(double *);
+extern void abort (void);
+
+void f2c_5a_(void) {
+  double a,b;
+  a = 1023.0;
+  b=f2c_5b_(&a);
+  if ( a != b ) abort();
+}


NOTICE
This e-mail and any attachments are private and confidential and may contain privileged information. If you are not an authorised recipient, the copying or distribution of this e-mail and any attachments is prohibited and you must not read, print or act in reliance on this e-mail or attachments.
This notice should not be removed.


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