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: [PATCH] PR fortran/12632: -fbounds-check ICE


Roger Sayle wrote:

As discovered by Andrew Pinski however, that fix alone isn't sufficient
for the above testcase, when optimizations are specified.  The fortran
front-end has a extremely clever optimization that realizes that if an
array is always only indexed by constants it need not be forced into
memory.  For the test-case above, the array I(1) *is* only indexed by
integer constants, and therefore gets assigned during g77's RTL expansion
to a single SImode register.

Of course, expand_assignment in expr.c only allows ARRAY_REFs to be
anything other than MEMs if the offset is extremely simple, i.e. constant
zero.  For constant integer indices that are within bounds, they'll get
folded down to a constant, everything works fine.  However, COMPOUND_EXPRs
or COND_EXPRs or any other way of wrapping a "noreturn" function call are
treated by the RTL expanders as a non-trivial offsets, and we therefore
abort.

Ugh.


Ok for mainline? And 3.3 after a few days?

Yes for the g77 part - thanks !


--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)


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