public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/39375] asm with a "=X" output overwrites the output
[not found] <bug-39375-4@http.gcc.gnu.org/bugzilla/>
@ 2012-01-02 4:17 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-02 4:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39375
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-02 04:16:52 UTC ---
__asm__ ("xxx" : "+X" (sum));
Is most likely what you want to use. This says the sum might be clobbered but
it might not be as the same value is used if it was not.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/39375] asm with a "=X" output overwrites the output
2009-03-05 2:53 [Bug c/39375] New: " balrogg at gmail dot com
` (3 preceding siblings ...)
2009-03-16 16:53 ` balrogg at gmail dot com
@ 2009-03-16 17:02 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-03-16 17:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2009-03-16 17:02 -------
(In reply to comment #4)
> Reopening because
> int params; __asm__ ("xxx" : "=X" (params));
> and
> int params[1]; __asm__ ("xxx" : "=X" (params[0]));
> still produce different output in a way that is undocumented.
How so? "=X" (params[0]) says it can be in memory which means params is
addressable. This is documented as "=X" really means "=rfm" (plus extra
constraints which don't correspond to r, f, or m).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39375
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/39375] asm with a "=X" output overwrites the output
2009-03-05 2:53 [Bug c/39375] New: " balrogg at gmail dot com
` (2 preceding siblings ...)
2009-03-06 10:34 ` balrogg at gmail dot com
@ 2009-03-16 16:53 ` balrogg at gmail dot com
2009-03-16 17:02 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: balrogg at gmail dot com @ 2009-03-16 16:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from balrogg at gmail dot com 2009-03-16 16:53 -------
Reopening because
int params; __asm__ ("xxx" : "=X" (params));
and
int params[1]; __asm__ ("xxx" : "=X" (params[0]));
still produce different output in a way that is undocumented.
--
balrogg at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39375
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/39375] asm with a "=X" output overwrites the output
2009-03-05 2:53 [Bug c/39375] New: " balrogg at gmail dot com
2009-03-05 2:55 ` [Bug c/39375] " balrogg at gmail dot com
2009-03-05 10:42 ` rguenth at gcc dot gnu dot org
@ 2009-03-06 10:34 ` balrogg at gmail dot com
2009-03-16 16:53 ` balrogg at gmail dot com
2009-03-16 17:02 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: balrogg at gmail dot com @ 2009-03-06 10:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from balrogg at gmail dot com 2009-03-06 10:34 -------
(In reply to comment #2)
> You need to use a "memory" clobber instead. "=X" (params[1]) says to GCC
> that the asm operand 0 should be stored to params[1], which it does
> (it allocates %eax to it).
Note that "=r" doesn't produce the useless move. Neither does "=X" (params) if
params is an integer.
Note also that the documentation uses "=X" (sum) as an example of adding a
dependency on the asm statement.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39375
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/39375] asm with a "=X" output overwrites the output
2009-03-05 2:53 [Bug c/39375] New: " balrogg at gmail dot com
2009-03-05 2:55 ` [Bug c/39375] " balrogg at gmail dot com
@ 2009-03-05 10:42 ` rguenth at gcc dot gnu dot org
2009-03-06 10:34 ` balrogg at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-03-05 10:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-03-05 10:42 -------
You need to use a "memory" clobber instead. "=X" (params[1]) says to GCC
that the asm operand 0 should be stored to params[1], which it does
(it allocates %eax to it). Note that plain use of %eax and %dx is a
bad idea as well, instead you should use proper inputs and outputs with
register constraints.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39375
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/39375] asm with a "=X" output overwrites the output
2009-03-05 2:53 [Bug c/39375] New: " balrogg at gmail dot com
@ 2009-03-05 2:55 ` balrogg at gmail dot com
2009-03-05 10:42 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: balrogg at gmail dot com @ 2009-03-05 2:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from balrogg at gmail dot com 2009-03-05 02:55 -------
(In reply to comment #0)
> Similarly for "=X" but not "=m" or "=r".
Rather, similarly for "=g".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39375
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-02 4:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-39375-4@http.gcc.gnu.org/bugzilla/>
2012-01-02 4:17 ` [Bug c/39375] asm with a "=X" output overwrites the output pinskia at gcc dot gnu.org
2009-03-05 2:53 [Bug c/39375] New: " balrogg at gmail dot com
2009-03-05 2:55 ` [Bug c/39375] " balrogg at gmail dot com
2009-03-05 10:42 ` rguenth at gcc dot gnu dot org
2009-03-06 10:34 ` balrogg at gmail dot com
2009-03-16 16:53 ` balrogg at gmail dot com
2009-03-16 17:02 ` 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).