public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49148] New: Certain expressions take an extremely long time for no apparent reason
@ 2011-05-24 19:14 jchthys at yahoo dot com
  2011-05-24 19:16 ` [Bug c/49148] " jchthys at yahoo dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jchthys at yahoo dot com @ 2011-05-24 19:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49148

           Summary: Certain expressions take an extremely long time for no
                    apparent reason
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jchthys@yahoo.com


Created attachment 24349
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24349
This is a minimal test case of an expression that takes 100 times longer to
evaluate than it should. See comments for explanations.

I have been doing work on 1-D Jacobi stencils. Basically, this involves a lot
of repeated operations. For some reason, however, I have been getting extremely
long run times for certain expressions. What is weird is that if I TAKE OUT a
multiply operation, the function takes about 100 times longer to run than if I
left it in.

The line that causes the problems is marked in the source code. It reads:

     new[i] = (A[i-1] + A[i] + A[i+1]) / 4.0;

If I change this to the following, there is no problem:

     new[i] = (A[i-1] + 2*A[i] + A[i+1]) / 4.0;

As another example, the following line runs slowly:

     new[i] = (A[i-1] + A[i] + A[i+1]) * 0.3;

while this line runs quickly:

     new[i] = (A[i-1] + 2*A[i] + A[i+1]) * 0.333;

The reason I think this is a bug is that it does not happen with older versions
of GCC (for example, 4.1.2), nor with the Intel C Compiler.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-26 12:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 19:14 [Bug c/49148] New: Certain expressions take an extremely long time for no apparent reason jchthys at yahoo dot com
2011-05-24 19:16 ` [Bug c/49148] " jchthys at yahoo dot com
2011-05-24 19:41 ` jchthys at yahoo dot com
2011-05-24 20:06 ` jchthys at yahoo dot com
2011-05-24 20:42 ` pinskia at gcc dot gnu.org
2011-05-24 21:47 ` [Bug rtl-optimization/49148] " jchthys at yahoo dot com
2011-05-24 21:55 ` jchthys at yahoo dot com
2011-05-25  9:56 ` rguenth at gcc dot gnu.org
2011-05-25 14:45 ` jchthys at yahoo dot com
2021-12-26 12:49 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).