public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15061] New: c++ complex<double> arguments
@ 2004-04-22  4:41 jifl-bugzilla at jifvik dot org
  2004-04-22  5:24 ` [Bug optimization/15061] " jifl-bugzilla at jifvik dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jifl-bugzilla at jifvik dot org @ 2004-04-22  4:41 UTC (permalink / raw)
  To: gcc-bugs

This is a bit of code compiled with g++ and using <complex> from libstdc++, but
the issue is an optimization one. Something Bad(tm) happens when complex
arguments are passed. The function prolog misuses the registers.

The small test case in question (which I'll attach separately) when compiled
with "arm-elf-g++ -O2" will produce the output:
Comparing (1,0) with (0,0)
(1,0) != (0,0)!

After a lot of playing I found it could also be reproduced with "arm-elf-g++ -O1
-fcse-skip-blocks":
Comparing (1,0) with (0,0)
(1,0) != (0,0)!

If compiled with "arm-elf-g++ -O2 -fno-cse-skip-blocks" however the problem does
not disappear, so I don't expect any issue with -fcse-skip-blocks itself, but it
just changes the optimizer state sufficiently. Curiously though, the output
isn't quite the same:
Comparing (1,0) with (1,0)
(1,0) != (0,0)!

Various other -fno-* options with -O2 can cause the problem to appear and
disappear as well, so beware of using a different gcc from 3.3.3 - just because
the problem doesn't appear per se doesn't mean it has been fixed!

I tried a native linux gcc 3.3.3 on the test case and it works which may well
mean it's arm specific.

Looking at the generated assembler (in the -O1 -fcse-skip-blocks example) I
thought at first glance there was a problem in main:
        adr     r2, .L20
        ldmia   r2, {r2-r3}
        adr     r4, .L20+8
        ldmia   r4, {r4-r5}
where .L20 is:
.L20:
        .word   1072693248
        .word   0
        .word   0
        .word   0

However the -O1 code which appears to run correctly also has .L20 defined like
that. If compiled with -O0 something it indeed has the equivalent of the first
two words of .L20 being used to load both z1 and z2 which is more what I'd
expect. So maybe there are in fact two problems here? One where .L20 is defined
as above, and another being a code generation issue.

NB I haven't been able to play with 3.4 due to problems with it on my target.

Let me know if you want more info.

-- 
           Summary: c++ complex<double> arguments
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jifl-bugzilla at jifvik dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnulibc2
  GCC host triplet: i686-pc-linux-gnulibc2
GCC target triplet: arm-elf


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


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

* [Bug optimization/15061] c++ complex<double> arguments
  2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
@ 2004-04-22  5:24 ` jifl-bugzilla at jifvik dot org
  2004-04-22  5:25 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jifl-bugzilla at jifvik dot org @ 2004-04-22  5:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jifl-bugzilla at jifvik dot org  2004-04-22 04:31 -------
Created an attachment (id=6135)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6135&action=view)
Test case showing failure


-- 


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


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

* [Bug optimization/15061] c++ complex<double> arguments
  2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
  2004-04-22  5:24 ` [Bug optimization/15061] " jifl-bugzilla at jifvik dot org
@ 2004-04-22  5:25 ` pinskia at gcc dot gnu dot org
  2004-04-22  5:38 ` jifl-bugzilla at jifvik dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-22  5:25 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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


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

* [Bug optimization/15061] c++ complex<double> arguments
  2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
  2004-04-22  5:24 ` [Bug optimization/15061] " jifl-bugzilla at jifvik dot org
  2004-04-22  5:25 ` pinskia at gcc dot gnu dot org
@ 2004-04-22  5:38 ` jifl-bugzilla at jifvik dot org
  2004-05-26 20:12 ` [Bug target/15061] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jifl-bugzilla at jifvik dot org @ 2004-04-22  5:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jifl-bugzilla at jifvik dot org  2004-04-22 04:41 -------
Actually forget what I said about .L20 etc. I've just realised that the
assembler generated there is okay... it just slipped my mind that the complex
will be 4 words long, two for each double.

-- 


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


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

* [Bug target/15061] c++ complex<double> arguments
  2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
                   ` (2 preceding siblings ...)
  2004-04-22  5:38 ` jifl-bugzilla at jifvik dot org
@ 2004-05-26 20:12 ` pinskia at gcc dot gnu dot org
  2004-10-07  9:24 ` giovannibajo at libero dot it
  2004-12-12 14:45 ` [Bug target/15061] [arm] " lerdsuwa at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-26 20:12 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |target


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


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

* [Bug target/15061] c++ complex<double> arguments
  2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
                   ` (3 preceding siblings ...)
  2004-05-26 20:12 ` [Bug target/15061] " pinskia at gcc dot gnu dot org
@ 2004-10-07  9:24 ` giovannibajo at libero dot it
  2004-12-12 14:45 ` [Bug target/15061] [arm] " lerdsuwa at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: giovannibajo at libero dot it @ 2004-10-07  9:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-10-07 09:24 -------
Richard, Paul, this is an ARM problem. Would you please give a look?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu dot
                   |                            |org, pbrook at gcc dot gnu
                   |                            |dot org


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


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

* [Bug target/15061] [arm] c++ complex<double> arguments
  2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
                   ` (4 preceding siblings ...)
  2004-10-07  9:24 ` giovannibajo at libero dot it
@ 2004-12-12 14:45 ` lerdsuwa at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-12-12 14:45 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|c++ complex<double>         |[arm] c++ complex<double>
                   |arguments                   |arguments


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


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

end of thread, other threads:[~2004-12-12 14:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-22  4:41 [Bug optimization/15061] New: c++ complex<double> arguments jifl-bugzilla at jifvik dot org
2004-04-22  5:24 ` [Bug optimization/15061] " jifl-bugzilla at jifvik dot org
2004-04-22  5:25 ` pinskia at gcc dot gnu dot org
2004-04-22  5:38 ` jifl-bugzilla at jifvik dot org
2004-05-26 20:12 ` [Bug target/15061] " pinskia at gcc dot gnu dot org
2004-10-07  9:24 ` giovannibajo at libero dot it
2004-12-12 14:45 ` [Bug target/15061] [arm] " lerdsuwa at gcc dot gnu dot 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).