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

FX Coudert fxcoudert@gmail.com
Sun May 6 22:49:00 GMT 2007


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: substring_bounds.diff
Type: application/octet-stream
Size: 3147 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070506/6f35c3ef/attachment.obj>


More information about the Fortran mailing list