public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* basic asm and memory clobbers
@ 2015-11-09  0:10 David Wohlferd
  2015-11-09  9:32 ` Segher Boessenkool
  0 siblings, 1 reply; 58+ messages in thread
From: David Wohlferd @ 2015-11-09  0:10 UTC (permalink / raw)
  To: gcc; +Cc: rth, pinskia, Jeff Law, Sandra Loosemore

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

It seems like a doc update is what is needed to close PR24414 (Old-style 
asms don't clobber memory).  I'm working on this now (phase 1) in the 
unlikely event that someone is inspired to make a code change here instead.

Like  Richard Henderson, I rather expected basic (or "old-style") asm to 
perform a memory clobber (it doesn't).  This bug is now over a decade 
old, so presumably the question of how this is going to work is 
settled.  IAC, the docs should reflect the current behavior.

Based on this issue plus what I have learned since last updating this 
page, I'm proposing the attached patch.

dw

CCing the commenters from the bug.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 24414.patch --]
[-- Type: text/x-patch; name="24414.patch", Size: 1211 bytes --]

Index: extend.texi
===================================================================
--- extend.texi	(revision 229910)
+++ extend.texi	(working copy)
@@ -7353,7 +7353,8 @@
 @end itemize
 
 Safely accessing C data and calling functions from basic @code{asm} is more 
-complex than it may appear. To access C data, it is better to use extended 
+complex than it may appear. To access C data (including both local and
+global register variables), use extended
 @code{asm}.
 
 Do not expect a sequence of @code{asm} statements to remain perfectly 
@@ -7376,6 +7377,12 @@
 visibility of any symbols it references. This may result in GCC discarding 
 those symbols as unreferenced.
 
+Basic @code{asm} statements are not treated as though they used a "memory"
+clobber, although they do implicitly perform a clobber of the flags
+(@pxref{Clobbers}). Also, there is no implicit clobbering of registers,
+so any registers changed must be restored to their original value before
+exiting the @code{asm}.
+
 The compiler copies the assembler instructions in a basic @code{asm} 
 verbatim to the assembly language output file, without 
 processing dialects or any of the @samp{%} operators that are available with

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

end of thread, other threads:[~2015-11-27 17:45 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09  0:10 basic asm and memory clobbers David Wohlferd
2015-11-09  9:32 ` Segher Boessenkool
2015-11-16  1:23   ` David Wohlferd
2015-11-16 21:29     ` Jeff Law
2015-11-17  5:56       ` David Wohlferd
2015-11-17  9:27         ` Andrew Haley
2015-11-17 21:31         ` Jeff Law
2015-11-17 22:07           ` Andrew Pinski
2015-11-18 22:04             ` Jeff Law
2015-11-18  1:28           ` Segher Boessenkool
2015-11-18 22:08             ` Jeff Law
2015-11-20  1:24           ` David Wohlferd
2015-11-20  1:53             ` Sandra Loosemore
2015-11-22  5:09               ` David Wohlferd
2015-11-20  3:14             ` Segher Boessenkool
2015-11-20 10:45               ` David Wohlferd
2015-11-20 14:56                 ` Segher Boessenkool
2015-11-20 20:01                   ` Jeff Law
2015-11-20 22:07                     ` Paul_Koning
2015-11-20 10:17             ` Andrew Haley
2015-11-20 10:38               ` David Wohlferd
2015-11-20 11:14                 ` Andrew Haley
2015-11-20 12:38                   ` David Wohlferd
2015-11-20 13:05                     ` Richard Henderson
2015-11-20 15:20                       ` Segher Boessenkool
2015-11-20 15:30                         ` Richard Henderson
2015-11-20 15:34                           ` Jakub Jelinek
2015-11-20 16:14                             ` Richard Henderson
2015-11-20 23:56                               ` David Wohlferd
2015-11-21 12:57                                 ` David Wohlferd
2015-11-23  9:56                                   ` Joseph Myers
2015-11-23 10:04                                   ` Andrew Haley
2015-11-23 20:37                                     ` Jeff Law
2015-11-23 21:36                                       ` David Wohlferd
2015-11-23 21:44                                         ` Paul_Koning
2015-11-24  1:39                                           ` David Wohlferd
2015-11-24  2:22                                             ` Segher Boessenkool
2015-11-24  4:48                                               ` Jeff Law
2015-11-24  5:12                                                 ` Segher Boessenkool
2015-11-24  5:25                                                   ` Jeff Law
2015-11-24 17:13                                             ` Paul_Koning
2015-11-24 17:49                                               ` Ian Lance Taylor
2015-11-24 18:00                                                 ` Paul_Koning
2015-11-25  2:11                                               ` David Wohlferd
2015-11-25  9:09                                                 ` Andrew Haley
2015-11-23 21:03                                     ` David Wohlferd
2015-11-24  9:48                                       ` Andrew Haley
2015-11-20 16:21                           ` Segher Boessenkool
2015-11-27 17:45                           ` Segher Boessenkool
2015-11-20 18:24                       ` Jeff Law
2015-11-20 19:39                         ` Paul_Koning
2015-11-26 10:30                       ` Hans-Peter Nilsson
2015-11-26 12:35                         ` Segher Boessenkool
2015-11-26 16:26                           ` Hans-Peter Nilsson
2015-11-26 21:54                             ` David Wohlferd
2015-11-26 23:39                               ` Hans-Peter Nilsson
2015-11-27  1:04                                 ` David Wohlferd
2015-11-20 16:41                   ` Jeff Law

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).