This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,patch] Don't evaluate substring bounds multiple times


Hi all,

Please find attached an amended version of this patch. The first one
created a missed-optimization in references such as string(i:i), which
wasn't recognized as a one-character string any more (breaking
testcase gfortran.dg/single_char_string.f90 [1]). The new version of
the patch avoids calling gfc_evaluate_now() if the start or end bound
is a reference to a variable.

Bootstrapped and regtested on i686-linux, OK for mainline? OK for 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



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.


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]