This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step
- From: FX <fxcoudert at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, fortran at gcc dot gnu dot org, Martin Liška <mliska at suse dot cz>, Richard Biener <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Dominique Dhumieres <dominiq at lps dot ens dot fr>, williamclodius at gmail dot com
- Date: Fri, 8 Jul 2016 11:12:55 +0200
- Subject: Re: [PATCH 0/2, fortran] Better code generation for DO loops with +-1 step
- Authentication-results: sourceware.org; auth=none
- References: <cover.1467883947.git.mliska@suse.cz> <CAFiYyc0FM93FwqjYOB+V2yn8b=g5xFL09U2xT0gaCOZLc4z3tA@mail.gmail.com> <20160707144035.GA30837@kam.mff.cuni.cz> <c1dd7016-53bc-0ff9-cb26-36054bfdbaaa@suse.cz> <20160708084029.GZ7387@tucnak.redhat.com> <20160708090334.GJ69430@kam.mff.cuni.cz> <20160708090503.GA7387@tucnak.redhat.com>
>>>>> This is what Fortran standard says:
>>>>>
>>>>> The iteration count is established and is the value of the expression (m2-m1+m3)/m3 unless that value is negative,
>>>>> in which case the iteration count is 0.
>>>>>
>>>>> My reading of this is that the do statement is undefined whenever the expression above is undefined
>>>>> (m1 is lower bound, m2 is upper bound, m3 is step) and because I think the evaulation order of
>>>>> m2-m1+m3 is not fixed, I think the statement is not defined whethever (m2-m1), (m1+m3) or (m2-m1)+m3
In the Fortran standard, (m2-m1+m3)/m3 is a mathematical expression, not a “construct”. So it cannot be “undefined”.
If you have explicit cases where you are asking “is this valid or invalid” please post them here (fortran@) and we will tell you.
FX