fortran patch
Dave Love
d.love@dl.ac.uk
Sun Nov 2 05:12:00 GMT 1997
This patch should be included to fix a significant Fortran bug.
Regression test below.
-------------- next part --------------
Date: Fri, 10 Oct 1997 16:31:42 -0400 (EDT)
Message-Id: <199710102031.QAA27219@tarpit.Cadence.COM>
From: Craig Burley <cburley@cadence.com>
To: fortran@gnu.org, masik@nc25.troja.mff.cuni.cz
Subject: g77 patch to fix DO bug -- g77-971010.diff.gz
Here's the patch I *would* just upload to ~fortran/dev/ normally, but
which I can't due to the FSF being (mostly) offline. Don't worry
about it if you don't have the other two or three patches; only the
documentation patchlet enclosed will be inappropriate in that case.
tq vm, (burley)
*** g77-new/f/ChangeLog.~1~ Mon Sep 29 16:21:27 1997
--- g77-new/f/ChangeLog Fri Oct 10 13:07:18 1997
***************
*** 1,2 ****
--- 1,12 ----
+ Fri Oct 10 13:00:48 1997 Craig Burley <burley@gnu.ai.mit.edu>
+
+ * ste.c (ffeste_begin_iterdo_): Fix loop setup so iteration
+ variable is modified only after the #iterations is calculated;
+ otherwise if the iteration variable is aliased to any of the
+ operands in the start, end, or increment expressions, the
+ wrong #iterations might be calculated.
+
+ * com.c (ffecom_save_tree): Fix indentation.
+
Mon Sep 29 16:18:21 1997 Craig Burley <burley@gnu.ai.mit.edu>
*** g77-new/f/com.c.~1~ Tue Sep 2 17:25:26 1997
--- g77-new/f/com.c Fri Oct 10 13:00:43 1997
*************** ffecom_return_expr (ffebld expr)
*** 13269,13273 ****
#if FFECOM_targetCURRENT == FFECOM_targetGCC
! tree ffecom_save_tree (tree t)
{
return save_expr (t);
--- 13269,13274 ----
#if FFECOM_targetCURRENT == FFECOM_targetGCC
! tree
! ffecom_save_tree (tree t)
{
return save_expr (t);
*** g77-new/f/news.texi.~1~ Tue Sep 9 02:11:37 1997
--- g77-new/f/news.texi Fri Oct 10 15:12:13 1997
***************
*** 6,10 ****
@c in the G77 distribution, as well as in the G77 manual.
! @c 1997-09-09
@ifclear NEWSONLY
--- 6,10 ----
@c in the G77 distribution, as well as in the G77 manual.
! @c 1997-10-10
@ifclear NEWSONLY
*************** diagnostics, internal improvements, and
*** 24,27 ****
--- 24,68 ----
This order is not strict---for example, some items
involve a combination of these elements.
+
+ @heading In 0.5.22:
+ @itemize @bullet
+ @item
+ Fix code generation for iterative @code{DO} loops that
+ have one or more references to the iteration variable,
+ or to aliases of it, in their control expressions.
+ For example, @samp{DO 10 J=2,J} now is compiled correctly.
+
+ @item
+ Fix a compiler crash involving optimization of
+ certain complicated expressions involving @code{COMPLEX}
+ arithmetic (especially multiplication).
+
+ @item
+ Rename the @code{gcc} keyword @code{restrict} to
+ @code{__restrict__}, to avoid rejecting valid, existing,
+ C programs.
+ Support for @code{restrict} is now more like support
+ for @code{complex}.
+
+ @item
+ Fix @code{DTime} intrinsic so as not to truncate
+ results to integer values (on some systems).
+
+ @item
+ Improve diagnostic messages from @code{libf2c}
+ so it is more likely that the printing of the
+ active format string is limited to the string,
+ with no trailing garbage being printed.
+
+ (Unlike @code{f2c}, @code{g77} does not append
+ a null byte to its compiled form of every
+ format string specified via a @code{FORMAT} statement.
+ However, @code{f2c} would exhibit the problem
+ anyway for a statement like @samp{PRINT '(I)garbage', 1}
+ by printing @samp{(I)garbage} as the format string.)
+
+ @item
+ Upgrade to @code{libf2c} as of 1997-09-23.
+ @end itemize
@heading In 0.5.21:
*** g77-new/f/ste.c.~1~ Mon Aug 11 14:53:40 1997
--- g77-new/f/ste.c Fri Oct 10 13:06:03 1997
*************** ffeste_begin_iterdo_ (ffestw block, tree
*** 396,405 ****
/* Do the initial assignment into the DO var. */
! expr = ffecom_modify (void_type_node, tvar, tstart);
! expand_expr_stmt (expr);
expr = ffecom_2 (MINUS_EXPR, TREE_TYPE (tvar),
tend,
! TREE_CONSTANT (tstart) ? tstart : tvar);
if (!ffe_is_onetrip ())
--- 396,404 ----
/* Do the initial assignment into the DO var. */
! tstart = ffecom_save_tree (tstart);
expr = ffecom_2 (MINUS_EXPR, TREE_TYPE (tvar),
tend,
! tstart);
if (!ffe_is_onetrip ())
*************** ffeste_begin_iterdo_ (ffestw block, tree
*** 438,441 ****
--- 437,443 ----
FFETARGET_charactersizeNONE, -1, FALSE);
expr = ffecom_modify (void_type_node, niters, expr);
+ expand_expr_stmt (expr);
+
+ expr = ffecom_modify (void_type_node, tvar, tstart);
expand_expr_stmt (expr);
-------------- next part --------------
* Fri Oct 10 13:00:48 1997 Craig Burley <burley@gnu.ai.mit.edu>
*
* * ste.c (ffeste_begin_iterdo_): Fix loop setup so iteration
* variable is modified only after the #iterations is calculated;
* otherwise if the iteration variable is aliased to any of the
* operands in the start, end, or increment expressions, the
i=3
j=0
do i=i,5
j = j+i
end do
do i=3,i
j = j+i
end do
if (i.ne.7) call abort()
print *, i,j
end
More information about the Gcc-bugs
mailing list