[gfortran] PATCH Fix command_argument_count intrinsic function
Steve Kargl
sgk@troutmask.apl.washington.edu
Sat Feb 26 05:29:00 GMT 2005
When I fixed the off-by-1 problem with iargc in PR libfortran/20085,
I did not realize that command_argument_count called iargc to get the
argument count and then it subtracted 1. Thus, command_argument_count
was account for the command name twice. In essence, iargc and
command_argument_count are equivalent.
bootstrap and regtested on i386-*-freebsd.
This is a regression. OK for mainline?
2005-05-25 Steven G. Kargl <kargls@comcast.net>
* trans-intrinsic.c (gfc_conv_intrinsic_iargc): remove boolean argument.
(gfc_conv_intrinsic_function): update function calls
--
Steve
-------------- next part --------------
Index: trans-intrinsic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-intrinsic.c,v
retrieving revision 1.43
diff -u -b -u -r1.43 trans-intrinsic.c
--- trans-intrinsic.c 23 Jan 2005 14:36:25 -0000 1.43
+++ trans-intrinsic.c 26 Feb 2005 04:53:18 -0000
@@ -2649,11 +2649,10 @@
}
-/* Generate code for the IARGC intrinsic. If args_only is true this is
- actually the COMMAND_ARGUMENT_COUNT intrinsic, so return IARGC - 1. */
+/* Generate code for the IARGC intrinsic. */
static void
-gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr, bool args_only)
+gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr)
{
tree tmp;
tree fndecl;
@@ -2667,8 +2666,6 @@
type = gfc_typenode_for_spec (&expr->ts);
tmp = fold_convert (type, tmp);
- if (args_only)
- tmp = build2 (MINUS_EXPR, type, tmp, build_int_cst (type, 1));
se->expr = tmp;
}
@@ -2827,7 +2824,7 @@
break;
case GFC_ISYM_COMMAND_ARGUMENT_COUNT:
- gfc_conv_intrinsic_iargc (se, expr, TRUE);
+ gfc_conv_intrinsic_iargc (se, expr);
break;
case GFC_ISYM_CONJG:
@@ -2869,7 +2866,7 @@
break;
case GFC_ISYM_IARGC:
- gfc_conv_intrinsic_iargc (se, expr, FALSE);
+ gfc_conv_intrinsic_iargc (se, expr);
break;
case GFC_ISYM_IEOR:
More information about the Fortran
mailing list