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

Re: fortran/893: Preliminary loop exit compiled wrongly


List subscription (i.e., Alfredo Ferrari) wrote:

> that patch seems to fix that bug and similar ones I found and reported.
> The patch was issued after I made a report to Bugzilla (the RH bug tracking
> system). They reacted at the speed of light.... many thanks to Jakub
> Jelinek from RedHat.

Thanks Jakub !   I guess you created the C test suite file because you
weren't sure the Fortran one triggered the same bug ?

> For Toon: indeed the 7+ miscompiled routines I had seem to be all ok after
> this patch (the bug was indeed very "popular").

Well, it *could* turn up in any loop with a goto going outside the loop
to a label not immediately following the loop end.  If you're code does
that a lot, there are a lot of opportunities for the bug to rear its
ugly head ...

Note how:

1. This bug must have been there for more than a year, as the MEM
   hoisting code is more than a year old.

2. The bug amazingly only triggered on the Intel architecture, while it
   was in a thoroughly general piece of optimization code, independent
   of the target architecture.

> I am still in the process
> to check carefully whether there are other problems floating around or not
> for what concerns our codes, I'll let you know.

Thanks, I'd really appreciate that !

> A naive question: is
> there any reason why the present g77 is significantly slower than the
> one in egcs-1.1.2 (20-30% slower on all the tests I made up to now, and
> now the results are consistent so the comparison should be sound)?

I know that in the past several bugs like the one fixed by Jakub have
been repaired.  The loop optimization code is very old (perhaps around
13 years old) and lots of optimizations are invalid if not all of the
code in the loop body is executed every turn (like in this "early-exit"
example).  It would not be unthinkable that egcs-1.1.2 still contains
several optimizations that are unsafe in general, but just happen to
work on your code.  Note that I'm guessing here - without thorough
examination of your code and the generated intermediate representation
in the compiler for both egcs-1.1.2 and the current snapshots nothing
can be concluded with certainty.

Hope this helps,

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

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