public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/51041] New: g++ strange optimisation behaviour
@ 2011-11-08 22:21 fb.programming at gmail dot com
  2011-11-08 22:23 ` [Bug other/51041] " fb.programming at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fb.programming at gmail dot com @ 2011-11-08 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51041
           Summary: g++ strange optimisation behaviour
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fb.programming@gmail.com


The attached code repeatedly executes a vector * vector product to test the
performance of the system. Compiled with

 g++ -Wall -O2 file.cpp

it results in a performance of about 1.7 Gflops on an Intel i5-750, ie
the output is

 adding:          0.059 s, 1.695 GFlops, sum=0.000000

However, when adding another printf (remove the comment in front of the
last printf) the performance deteriorates strongly (same compiler
options):

 adding:          0.195 s, 0.512 GFlops, sum=0.000000
 sum=0.000000

It seems the last printf confuses the compiler optimisation completely,
although it shouldn't make a difference at all, as the same variable
is already printed a few lines above.

This is worrying as it seems the compiler fails to fully optimise the
code under odd circumstances. I've used compiler version 4.6.2 as well as
4.4.1 which is the default compiler on the system.


$ gcc-4.6.2 --version
gcc-4.6.2 (GCC) 4.6.2

$ gcc --version
gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]

$ uname -a
Linux localhost 2.6.31.14-0.8-desktop #1 SMP PREEMPT 2011-04-06 18:09:24 +0200
x86_64 x86_64 x86_64 GNU/Linux


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

end of thread, other threads:[~2023-07-07 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08 22:21 [Bug other/51041] New: g++ strange optimisation behaviour fb.programming at gmail dot com
2011-11-08 22:23 ` [Bug other/51041] " fb.programming at gmail dot com
2011-11-08 22:31 ` [Bug rtl-optimization/51041] " pinskia at gcc dot gnu.org
2023-07-07 15:13 ` [Bug rtl-optimization/51041] register allocation of SSE register in loop with across eh edges vmakarov 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).