This is the mail archive of the 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]

[fortran PATCH] Reduce NON_LVALUE_EXPR usage in array indices

As shown in my post of just a few minutes ago, gfortran has a habit of
producing initial statement trees that look like:

      (*a)[NON_LVALUE_EXPR <S.0> + -1] = 0;

whilst prefectly valid, the NON_LVALUE_EXPR tends to make debugging fortran
array dependencies slightly harder than they need to be.  The source of these
nodes is fold, which when simplifying 1*x and x+0 uses this annotation to
assist the C/C++ front-ends from thinking that the returned "x" is a
potential lvalue.

The patch below simply catches a few of the places where these
NON_LVALUE_EXPR trees nodes are accidentally created, which should reduce
memory usage and makes the dumps slightly easier to read...

      (*a)[S.0 + -1] = 0;

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all languages including gfortran, and regression tested
with a top-level "make -k check" with no new failures.

Ok for mainline?

2006-12-16  Roger Sayle  <>

        * trans-array.c (gfc_conv_array_index_offset): Avoid multiplying
        index by one, or adding zero to it.


Attachment: patchf.txt
Description: Text document

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