public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument
@ 2005-05-27 18:21 evandro at yahoo dot com
  2005-05-27 18:23 ` [Bug target/21788] " evandro at yahoo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: evandro at yahoo dot com @ 2005-05-27 18:21 UTC (permalink / raw)
  To: gcc-bugs

Using -O2 or greater, when taking the address of an input argument results in
the wrong code.  For example:

int foo (double d)
{
  int *p = (int *) &d;

  return (*p);
}

With -O2 results in:

foo:
	movq	-8(%rsp), %eax
	ret

With -O1 results in:

foo:
	movsd	%xmm0, -8(%rsp)
	movq	-8(%rsp), %eax
	ret

-- 
           Summary: [x86_64] Wrong Code When Taking Address of Argument
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: evandro at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug target/21788] [x86_64] Wrong Code When Taking Address of Argument
  2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
@ 2005-05-27 18:23 ` evandro at yahoo dot com
  2005-05-27 18:24 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: evandro at yahoo dot com @ 2005-05-27 18:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From evandro at yahoo dot com  2005-05-27 18:21 -------
Created an attachment (id=8982)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8982&action=view)
Test-case.

If compiled for x86_64 with -O2 or greater, results in bogus code.

-- 


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


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

* [Bug target/21788] [x86_64] Wrong Code When Taking Address of Argument
  2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
  2005-05-27 18:23 ` [Bug target/21788] " evandro at yahoo dot com
@ 2005-05-27 18:24 ` pinskia at gcc dot gnu dot org
  2005-05-27 18:39 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-27 18:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-27 18:23 -------
You are violating C aliasing rules, does -fno-strict-aliasing help?

-- 


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


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

* [Bug target/21788] [x86_64] Wrong Code When Taking Address of Argument
  2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
  2005-05-27 18:23 ` [Bug target/21788] " evandro at yahoo dot com
  2005-05-27 18:24 ` pinskia at gcc dot gnu dot org
@ 2005-05-27 18:39 ` pinskia at gcc dot gnu dot org
  2005-05-27 19:20 ` evandro at yahoo dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-27 18:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-27 18:34 -------
You are violating C aliasing rules.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug target/21788] [x86_64] Wrong Code When Taking Address of Argument
  2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
                   ` (2 preceding siblings ...)
  2005-05-27 18:39 ` pinskia at gcc dot gnu dot org
@ 2005-05-27 19:20 ` evandro at yahoo dot com
  2005-06-05  9:22 ` pinskia at gcc dot gnu dot org
  2005-06-05  9:23 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: evandro at yahoo dot com @ 2005-05-27 19:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From evandro at yahoo dot com  2005-05-27 18:39 -------
(In reply to comment #2)
The wonders of -Wall...

Yes, -fno-strict-aliasing does help.

-- 


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


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

* [Bug target/21788] [x86_64] Wrong Code When Taking Address of Argument
  2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
                   ` (3 preceding siblings ...)
  2005-05-27 19:20 ` evandro at yahoo dot com
@ 2005-06-05  9:22 ` pinskia at gcc dot gnu dot org
  2005-06-05  9:23 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05  9:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 09:22 -------
Reopening to ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug target/21788] [x86_64] Wrong Code When Taking Address of Argument
  2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
                   ` (4 preceding siblings ...)
  2005-06-05  9:22 ` pinskia at gcc dot gnu dot org
@ 2005-06-05  9:23 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05  9:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 09:23 -------
Mark as a dup of bug 21920.

*** This bug has been marked as a duplicate of 21920 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-06-05  9:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-27 18:21 [Bug target/21788] New: [x86_64] Wrong Code When Taking Address of Argument evandro at yahoo dot com
2005-05-27 18:23 ` [Bug target/21788] " evandro at yahoo dot com
2005-05-27 18:24 ` pinskia at gcc dot gnu dot org
2005-05-27 18:39 ` pinskia at gcc dot gnu dot org
2005-05-27 19:20 ` evandro at yahoo dot com
2005-06-05  9:22 ` pinskia at gcc dot gnu dot org
2005-06-05  9:23 ` pinskia 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).