This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran,patch] Don't evaluate substring bounds multiple times
- From: FX Coudert <fxcoudert at gmail dot com>
- To: gfortran List <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 7 May 2007 00:48:55 +0200
- Subject: [gfortran,patch] Don't evaluate substring bounds multiple times
Hi all,
Attached patch fixes PR31725: we currently evaluate multiple times
the bounds of a substring, which of course leads to nasty wrong-code
bugs when said bounds have side effects. This simple two-lines patch
Bootstrapped && regtested on i686-linux, comes with a testcase from
the PR. OK for mainline? Is that nasty enough that we want to
backport it to 4.2? (the backport is trivial and with low risk, that
part of the front-end hasn't changed since branching; I'd go for it
myself, but wanted to ask for opinions here)
FX
:ADDPATCH fortran:
2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31725
* trans-expr.c (gfc_conv_substring): Evaluate substring bounds
only once.
2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31725
* gfortran.dg/substr_4.f: New test.
Attachment:
substring_bounds.diff
Description: Binary data