public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug 45771] (c) New: Source operands for conditional moves
@ 2010-09-24 0:46 rmansfield at qnx dot com
2010-09-24 0:47 ` [Bug 45771] (target) " rmansfield at qnx dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: rmansfield at qnx dot com @ 2010-09-24 0:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45771
Summary: Source operands for conditional moves
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rmansfield@qnx.com
Host: x86_64-linux-gnu
Target: x86_64-linux-gnu
Build: x86_64-linux-gnu
$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-linux-gnu
Configured with: ../configure --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.0 20100923 (experimental) [trunk revision 164569] (GCC)
#define NULL 0
typedef struct List List;
struct List {
List *next;
int stuff;
};
extern List Ignore;
extern List *pending, **tail;
extern void process(List *);
void
proc_all()
{
List *irp;
for( ;; ) {
irp = pending;
pending = NULL;
if(irp == &Ignore) {
irp = irp->next;
}
if(irp == NULL) break;
pending = irp->next;
process(irp);
}
}
-O2 generates
movq pending(%rip), %rdi
movq $0, pending(%rip)
cmpq $Ignore, %rdi
cmove (%rdi), %rdi
testq %rdi, %rdi
Since cmove always references the source operand regardless of the result of
the condition, and (%idi) can be null which will cause the program to crash.
The pseudo code for cmove:
cmove(condition, SRC, DEST)
{
TEMP = SRC
if (condition)
DST = TEMP
}
--
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug 45771] (target) Source operands for conditional moves
2010-09-24 0:46 [Bug 45771] (c) New: Source operands for conditional moves rmansfield at qnx dot com
@ 2010-09-24 0:47 ` rmansfield at qnx dot com
2010-09-24 3:15 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rmansfield at qnx dot com @ 2010-09-24 0:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45771
Ryan Mansfield <rmansfield at qnx dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |target
--- Comment #1 from Ryan Mansfield <rmansfield at qnx dot com> 2010-09-24 00:47:48 UTC ---
Change component.
--
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug 45771] (target) Source operands for conditional moves
2010-09-24 0:46 [Bug 45771] (c) New: Source operands for conditional moves rmansfield at qnx dot com
2010-09-24 0:47 ` [Bug 45771] (target) " rmansfield at qnx dot com
@ 2010-09-24 3:15 ` pinskia at gcc dot gnu.org
2010-09-24 4:19 ` rmansfield at qnx dot com
2012-01-21 20:26 ` [Bug target/45771] " pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-09-24 3:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45771
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|middle-end |target
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-09-24 02:58:05 UTC ---
>Since cmove
Really??? That seems weird.
--
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug 45771] (target) Source operands for conditional moves
2010-09-24 0:46 [Bug 45771] (c) New: Source operands for conditional moves rmansfield at qnx dot com
2010-09-24 0:47 ` [Bug 45771] (target) " rmansfield at qnx dot com
2010-09-24 3:15 ` pinskia at gcc dot gnu.org
@ 2010-09-24 4:19 ` rmansfield at qnx dot com
2012-01-21 20:26 ` [Bug target/45771] " pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: rmansfield at qnx dot com @ 2010-09-24 4:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45771
--- Comment #3 from Ryan Mansfield <rmansfield at qnx dot com> 2010-09-24 03:15:16 UTC ---
(In reply to comment #2)
> >Since cmove
>
> Really??? That seems weird.
www.intel.com/assets/pdf/manual/253666.pdf
Vol. 2A 3-155 (page 199-200)
Though I believe the unconditional read only happens if the source operand is a
memory operand.
--
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/45771] Source operands for conditional moves
2010-09-24 0:46 [Bug 45771] (c) New: Source operands for conditional moves rmansfield at qnx dot com
` (2 preceding siblings ...)
2010-09-24 4:19 ` rmansfield at qnx dot com
@ 2012-01-21 20:26 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-21 20:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45771
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-21 20:17:38 UTC ---
Fixed by:
http://gcc.gnu.org/ml/gcc-patches/2011-09/msg01567.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-01-21 20:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-24 0:46 [Bug 45771] (c) New: Source operands for conditional moves rmansfield at qnx dot com
2010-09-24 0:47 ` [Bug 45771] (target) " rmansfield at qnx dot com
2010-09-24 3:15 ` pinskia at gcc dot gnu.org
2010-09-24 4:19 ` rmansfield at qnx dot com
2012-01-21 20:26 ` [Bug target/45771] " 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).