From 2b0bdd9a77061bf3152e4b308ec3598a8552bd14 Mon Sep 17 00:00:00 2001 From: Craig Burley Date: Mon, 3 May 1999 16:07:36 +0000 Subject: [PATCH] reverse order of arguments to CTIME_subr, DTIME_subr, ETIME_subr, and TTYNAM_subr From-SVN: r26756 --- gcc/f/ChangeLog | 12 ++++++++++ gcc/f/com.c | 17 ++++++------- gcc/f/intdoc.in | 24 +++++++++---------- gcc/f/intrin.def | 8 +++---- gcc/f/news.texi | 10 ++++++++ gcc/f/version.c | 2 +- gcc/testsuite/ChangeLog | 5 ++++ .../g77.f-torture/execute/u77-test.f | 8 +++---- libf2c/ChangeLog | 5 ++++ libf2c/libU77/u77-test.f | 8 +++---- 10 files changed, 66 insertions(+), 33 deletions(-) diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 7741a538f95..90f7b7e27eb 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,15 @@ +Mon May 3 18:11:48 1999 Craig Burley + + Reverse order of two arguments to CTIME_subr, DTIME_subr, + ETIME_subr, and TTYNAM_subr: + * com.c (ffecom_expr_intrinsic_): Reverse the arguments. + While at it, set TREE_SIDE_EFFECTS for CTIME_subr and + TTYNAM_subr. + * intdoc.in: Document the new calling sequences. + * intrin.def: Reverse the arguments. + * news.texi: Document the fact that they changed. + * version.c: Bump version. + Mon May 3 11:28:14 1999 Craig Burley * news.texi: Doc upgrade to netlib libf2c as of today. diff --git a/gcc/f/com.c b/gcc/f/com.c index 3362ef3c0c3..a0f33e6e603 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -5265,12 +5265,12 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, tree arg1_tree; tree arg2_tree; - arg1_tree = ffecom_arg_ptr_to_expr (arg1, &arg1_len); + arg1_tree = ffecom_arg_ptr_to_expr (arg2, &arg1_len); arg2_tree = convert (((gfrt == FFEINTRIN_impCTIME_subr) ? ffecom_f2c_longint_type_node : ffecom_f2c_integer_type_node), - ffecom_expr (arg2)); + ffecom_expr (arg1)); arg2_tree = ffecom_1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (arg2_tree)), arg2_tree); @@ -5289,6 +5289,7 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, arg1_tree, NULL_TREE, NULL, NULL, NULL_TREE, TRUE, ffebld_nonter_hook (expr)); + TREE_SIDE_EFFECTS (expr_tree) = 1; } return expr_tree; @@ -5382,22 +5383,22 @@ ffecom_expr_intrinsic_ (ffebld expr, tree dest_tree, case FFEINTRIN_impETIME_subr: { tree arg1_tree; - tree arg2_tree; + tree result_tree; - arg1_tree = ffecom_expr_w (NULL_TREE, arg1); + result_tree = ffecom_expr_w (NULL_TREE, arg2); - arg2_tree = ffecom_ptr_to_expr (arg2); + arg1_tree = ffecom_ptr_to_expr (arg1); expr_tree = ffecom_call_ (ffecom_gfrt_tree_ (gfrt), ffecom_gfrt_kindtype (gfrt), FALSE, NULL_TREE, - build_tree_list (NULL_TREE, arg2_tree), + build_tree_list (NULL_TREE, arg1_tree), NULL_TREE, NULL, NULL, NULL_TREE, TRUE, ffebld_nonter_hook (expr)); - expr_tree = ffecom_modify (NULL_TREE, arg1_tree, - convert (TREE_TYPE (arg1_tree), + expr_tree = ffecom_modify (NULL_TREE, result_tree, + convert (TREE_TYPE (result_tree), expr_tree)); } return expr_tree; diff --git a/gcc/f/intdoc.in b/gcc/f/intdoc.in index 2027c5a4d7a..565b771c4fa 100644 --- a/gcc/f/intdoc.in +++ b/gcc/f/intdoc.in @@ -1043,9 +1043,9 @@ and returns that string as the function value. ") DEFDOC (CTIME_subr, "Convert time to Day Mon dd hh:mm:ss yyyy.", "\ -Converts @var{@2@}, a system time value, such as returned by +Converts @var{@1@}, a system time value, such as returned by @code{TIME8()}, to a string of the form @samp{Sat Aug 19 18:13:14 1995}, -and returns that string in @var{@1@}. +and returns that string in @var{@2@}. @xref{Time8 Intrinsic}. @@ -1096,10 +1096,10 @@ form is not recommended. DEFDOC (DTIME_subr, "Get elapsed time since last time.", "\ Initially, return the number of seconds of runtime since the start of the process's execution -in @var{@1@}, -and the user and system components of this in @samp{@var{@2@}(1)} -and @samp{@var{@2@}(2)} respectively. -The value of @var{@1@} is equal to @samp{@var{@2@}(1) + @var{@2@}(2)}. +in @var{@2@}, +and the user and system components of this in @samp{@var{@1@}(1)} +and @samp{@var{@1@}(2)} respectively. +The value of @var{@2@} is equal to @samp{@var{@1@}(1) + @var{@1@}(2)}. Subsequent invocations of @samp{@0@()} set values based on accumulations since the previous invocation. @@ -1140,10 +1140,10 @@ during a single run of the compiled program. DEFDOC (ETIME_subr, "Get elapsed time for process.", "\ Return the number of seconds of runtime since the start of the process's execution -in @var{@1@}, -and the user and system components of this in @samp{@var{@2@}(1)} -and @samp{@var{@2@}(2)} respectively. -The value of @var{@1@} is equal to @samp{@var{@2@}(1) + @var{@2@}(2)}. +in @var{@2@}, +and the user and system components of this in @samp{@var{@1@}(1)} +and @samp{@var{@1@}(2)} respectively. +The value of @var{@2@} is equal to @samp{@var{@1@}(1) + @var{@1@}(2)}. @cindex wraparound, timings @cindex limits, timings @@ -2381,8 +2381,8 @@ terminal. ") DEFDOC (TTYNAM_subr, "Get name of terminal device for unit.", "\ -Sets @var{@1@} to the name of the terminal device open on logical unit -@var{@2@} or a blank string if @var{@2@} is not connected to a +Sets @var{@2@} to the name of the terminal device open on logical unit +@var{@1@} or to a blank string if @var{@1@} is not connected to a terminal. Some non-GNU implementations of Fortran provide this intrinsic as diff --git a/gcc/f/intrin.def b/gcc/f/intrin.def index 9d9626bc7c2..4864abb7ddb 100644 --- a/gcc/f/intrin.def +++ b/gcc/f/intrin.def @@ -3237,7 +3237,7 @@ DEFIMP (CHMOD_subr, "CHMOD_subr", CHMOD,,, "--:-:Name=A1,Mode=A1,Status=?I1w") DEFIMP (COMPLEX, "COMPLEX", ,,, "C=:*:Real=S*,Imag=S*") DEFIMP (CPU_TIME, "CPU_TIME", SECOND,,, "--:-:Seconds=R*w") DEFIMP (CTIME_func, "CTIME_func", CTIME,,, "A1*:-:STime=I*") -DEFIMP (CTIME_subr, "CTIME_subr", CTIME,,, "--:-:Result=A1w,STime=I*") +DEFIMP (CTIME_subr, "CTIME_subr", CTIME,,, "--:-:STime=I*,Result=A1w") DEFIMPY (DATE, "DATE", DATE,,, "--:-:Date=A1w", TRUE) DEFIMP (DATE_AND_TIME, "DATE_AND_TIME", DATE_AND_TIME,,, "--:-:Date=A1w,Time=?A1w,Zone=?A1w,Values=?I1(8)w") DEFIMP (DBESJ0, "DBESJ0", L_BESJ0,,, "R2:-:X=R2") @@ -3253,11 +3253,11 @@ DEFIMP (DFLOAT, "DFLOAT", ,,, "R2:-:A=I*") DEFIMP (DIMAG, "DIMAG", ,DIMAG,, "R2:-:Z=C2") DEFIMP (DREAL, "DREAL", ,,, "R2:-:A=N*") DEFIMP (DTIME_func, "DTIME_func", DTIME,,, "R1:-:TArray=R1(2)w") -DEFIMP (DTIME_subr, "DTIME_subr", DTIME,,, "--:-:Result=R1w,TArray=R1(2)w") +DEFIMP (DTIME_subr, "DTIME_subr", DTIME,,, "--:-:TArray=R1(2)w,Result=R1w") DEFIMP (ERF, "ERF", L_ERF,ERF,, "R=:0:X=R*") DEFIMP (ERFC, "ERFC", L_ERFC,ERFC,, "R=:0:X=R*") DEFIMP (ETIME_func, "ETIME_func", ETIME,,, "R1:-:TArray=R1(2)w") -DEFIMP (ETIME_subr, "ETIME_subr", ETIME,,, "--:-:Result=R1w,TArray=R1(2)w") +DEFIMP (ETIME_subr, "ETIME_subr", ETIME,,, "--:-:TArray=R1(2)w,Result=R1w") DEFIMP (EXIT, "EXIT", EXIT,,, "--:-:Status=?I*") DEFIMP (FDATE_func, "FDATE_func", FDATE,,, "A1*:-:") DEFIMP (FDATE_subr, "FDATE_subr", FDATE,,, "--:-:Date=A1w") @@ -3348,7 +3348,7 @@ DEFIMP (TIME8, "TIME8", TIME,,, "I2:-:") DEFIMP (TIME_unix, "TIME_unix", TIME,,, "I1:-:") DEFIMP (TIME_vxt, "TIME_vxt", VXTTIME,,, "--:-:Time=A1[8]w") DEFIMP (TTYNAM_func, "TTYNAM_func", TTYNAM,,, "A1*:-:Unit=I*") -DEFIMP (TTYNAM_subr, "TTYNAM_subr", TTYNAM,,, "--:-:Name=A1w,Unit=I*") +DEFIMP (TTYNAM_subr, "TTYNAM_subr", TTYNAM,,, "--:-:Unit=I*,Name=A1w") DEFIMP (UMASK_func, "UMASK_func", UMASK,,, "I1:-:Mask=I*") DEFIMP (UMASK_subr, "UMASK_subr", UMASK,,, "--:-:Mask=I*,Old=?I1w") DEFIMP (UNLINK_func, "UNLINK_func", UNLINK,,, "I1:-:File=A1") diff --git a/gcc/f/news.texi b/gcc/f/news.texi index b60482f0fcd..73f3c854a96 100644 --- a/gcc/f/news.texi +++ b/gcc/f/news.texi @@ -217,6 +217,16 @@ Source file names with the suffixes @samp{.FOR} and @samp{.FPP} now are recognized by @code{g77} as if they ended in @samp{.for} and @samp{.fpp}, respectively. +@item +The order of arguments to the @emph{subroutine} forms of the +@code{CTime}, @code{DTime}, @code{ETime}, and @code{TtyNam} +intrinsics has been swapped. +The argument serving as the returned value +for the corresponding function forms +now is the @emph{second} argument, +making these consistent with the other subroutine forms +of @code{libU77} intrinsics. + @item @code{g77} now warns about a reference to an intrinsic that has an interface that is not Year 2000 (Y2K) compliant. diff --git a/gcc/f/version.c b/gcc/f/version.c index 9914a04510d..95242141ceb 100644 --- a/gcc/f/version.c +++ b/gcc/f/version.c @@ -1 +1 @@ -const char *ffe_version_string = "0.5.24-19990502"; +const char *ffe_version_string = "0.5.24-19990503"; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8aa7cb80145..10ea516a82d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +1999-05-03 Craig Burley + + * g77.f-torture/execute/u77-test.f: Reverse order of two + arguments to CTIME_subr, DTIME_subr, ETIME_subr, and TTYNAM_subr. + 1999-05-03 Kaveh R. Ghazi * gcc.dg/compare1.c: New test. diff --git a/gcc/testsuite/g77.f-torture/execute/u77-test.f b/gcc/testsuite/g77.f-torture/execute/u77-test.f index 7377f48938c..7ad343cadfd 100644 --- a/gcc/testsuite/g77.f-torture/execute/u77-test.f +++ b/gcc/testsuite/g77.f-torture/execute/u77-test.f @@ -75,7 +75,7 @@ bigi = time8 () - call ctime (ctim2, i) + call ctime (i, ctim2) if (ctim .ne. ctim2) then write (6, *) '*** CALL CTIME disagrees with CTIME(): ', + ctim2(:lenstr (ctim2)), ' vs. ', ctim(:lenstr (ctim)) @@ -103,7 +103,7 @@ line = 'and 6 isn''t a tty device (ISATTY)' end if write (6,'(1X,A)') line(:lenstr(line)) - call ttynam (line, 6) + call ttynam (6, line) if (line .ne. line2) then print *, '*** CALL TTYNAM disagrees with TTYNAM: ', + line(:lenstr (line)) @@ -186,10 +186,10 @@ c now try to get times to change enough to see in etime/dtime do i = 1,1000 do j = 1,1000 end do - call dtime (r2, tarray2) + call dtime (tarray2, r2) if (tarray2(1) .ne. 0. .or. tarray2(2) .ne. 0.) exit end do - call etime (r1, tarray1) + call etime (tarray1, r1) if (.not. issum (r1, tarray1(1), tarray1(2))) then write (6,*) '*** ETIME didn''t return sum of the array: ', + r1, ' /= ', tarray1(1), '+', tarray1(2) diff --git a/libf2c/ChangeLog b/libf2c/ChangeLog index 7ed7ca57ee6..6a02f5e92ae 100644 --- a/libf2c/ChangeLog +++ b/libf2c/ChangeLog @@ -1,3 +1,8 @@ +1999-05-03 Craig Burley + + * libU77/u77-test.f: Reverse order of two arguments to + CTIME_subr, DTIME_subr, ETIME_subr, and TTYNAM_subr. + Mon May 3 11:21:35 1999 Craig Burley * libF77/c_log.c: Cope with partial overlap a la z_log.c. diff --git a/libf2c/libU77/u77-test.f b/libf2c/libU77/u77-test.f index 88a7a83e357..96ba31c572e 100644 --- a/libf2c/libU77/u77-test.f +++ b/libf2c/libU77/u77-test.f @@ -78,7 +78,7 @@ bigi = time8 () - call ctime (ctim2, i) + call ctime (i, ctim2) if (ctim .ne. ctim2) then write (6, *) '*** CALL CTIME disagrees with CTIME(): ', + ctim2(:lenstr (ctim2)), ' vs. ', ctim(:lenstr (ctim)) @@ -106,7 +106,7 @@ line = 'and 6 isn''t a tty device (ISATTY)' end if write (6,'(1X,A)') line(:lenstr(line)) - call ttynam (line, 6) + call ttynam (6, line) if (line .ne. line2) then print *, '*** CALL TTYNAM disagrees with TTYNAM: ', + line(:lenstr (line)) @@ -189,10 +189,10 @@ c now try to get times to change enough to see in etime/dtime do i = 1,1000 do j = 1,1000 end do - call dtime (r2, tarray2) + call dtime (tarray2, r2) if (tarray2(1) .ne. 0. .or. tarray2(2) .ne. 0.) exit end do - call etime (r1, tarray1) + call etime (tarray1, r1) if (.not. issum (r1, tarray1(1), tarray1(2))) then write (6,*) '*** ETIME didn''t return sum of the array: ', + r1, ' /= ', tarray1(1), '+', tarray1(2)