This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] PATCH: Fix omitted optional CHARACTER arguments
Tobias Schlüter wrote:
Paul Brook wrote:
2004-06-03 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_actual_arglist): New field missing_arg_type.
* interface.c (compare_actual_formal): Keep type of omitted
optional arguments.
* trans-expr.c (gfc_conv_function_call): Add string length
argument for omitted string argument.
Ok. Please also add a a testcase. Maybe something like the following.
Checking through my tree I found that I missed one hunk in my patch,
which I committed as obvious. I didn't see this, because the testcase
doesn't catch this, as this hunk only affects calls to intrinsics. Once
we have GET_DATE_AND_TIME, I will submit a testcase which also tests
this for intrinsics.
Compiled and tested with no regressions on i686-pc-linux.
- Tobi
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/ChangeLog,v
retrieving revision 1.60
diff -u -p -r1.60 ChangeLog
--- ChangeLog 3 Jun 2004 22:35:39 -0000 1.60
+++ ChangeLog 5 Jun 2004 11:34:13 -0000
@@ -1,3 +1,8 @@
+2004-06-05 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * intrinsic.c (sort_actual): Keep track of type of missing
+ arguments. (Missing from previous commit.)
+
2004-06-03 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.h (gfc_actual_arglist): New field missing_arg_type.
Index: intrinsic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/intrinsic.c,v
retrieving revision 1.6
diff -u -p -r1.6 intrinsic.c
--- intrinsic.c 22 May 2004 17:28:48 -0000 1.6
+++ intrinsic.c 5 Jun 2004 11:34:13 -0000
@@ -1959,7 +1959,13 @@ do_sort:
for (f = formal; f; f = f->next)
{
- a = (f->actual == NULL) ? gfc_get_actual_arglist () : f->actual;
+ if (f->actual == NULL)
+ {
+ a = gfc_get_actual_arglist ();
+ a->missing_arg_type = f->ts.type;
+ }
+ else
+ a = f->actual;
if (actual == NULL)
*ap = a;