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]

[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


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