diff mbox

Wonly-top-basic-asm

Message ID 56EA3F55.7050103@LimeGreenSocks.com
State New
Headers show

Commit Message

David Wohlferd March 17, 2016, 5:23 a.m. UTC
On 3/14/2016 8:28 AM, Bernd Schmidt wrote:
> The example is not good, as discussed previously, and IMO the best 
> option is to remove it. Otherwise I have no objections to the latest 
> variant.

Despite the problems I have with the existing sample, adding the 
information/warnings is more important to me, and more valuable to 
users.  Perhaps we can revisit the sample when pr24414 gets addressed.

I have removed my changes to the sample in the attached patch.

ChangeLog:

2016-03-16  David Wohlferd  <dw@LimeGreenSocks.com>
         Bernd Schmidt  <bschmidt@redhat.com>

     * doc/extend.texi: Doc basic asm behavior re clobbers.

dw

Comments

Bernd Schmidt March 18, 2016, 12:46 p.m. UTC | #1
On 03/17/2016 06:23 AM, David Wohlferd wrote:
> 2016-03-16  David Wohlferd  <dw@LimeGreenSocks.com>
>          Bernd Schmidt  <bschmidt@redhat.com>
>
>      * doc/extend.texi: Doc basic asm behavior re clobbers.
>

Any objections from the release managers if I install this for David at 
this stage?


Bernd
Richard Biener March 18, 2016, 1:32 p.m. UTC | #2
On Fri, Mar 18, 2016 at 1:46 PM, Bernd Schmidt <bschmidt@redhat.com> wrote:
> On 03/17/2016 06:23 AM, David Wohlferd wrote:
>>
>> 2016-03-16  David Wohlferd  <dw@LimeGreenSocks.com>
>>          Bernd Schmidt  <bschmidt@redhat.com>
>>
>>      * doc/extend.texi: Doc basic asm behavior re clobbers.
>>
>
> Any objections from the release managers if I install this for David at this
> stage?

No.

Richard.

>
> Bernd
>
Bernd Schmidt March 18, 2016, 7:13 p.m. UTC | #3
On 03/17/2016 06:23 AM, David Wohlferd wrote:
> On 3/14/2016 8:28 AM, Bernd Schmidt wrote:
>> The example is not good, as discussed previously, and IMO the best
>> option is to remove it. Otherwise I have no objections to the latest
>> variant.
>
> Despite the problems I have with the existing sample, adding the
> information/warnings is more important to me, and more valuable to
> users.  Perhaps we can revisit the sample when pr24414 gets addressed.

My thought was to remove the example altogether, which we might want to 
do later on. But for now I've committed your change since it can be seen 
as an improvement in itself.


Bernd
diff mbox

Patch

Index: extend.texi
===================================================================
--- extend.texi	(revision 234245)
+++ extend.texi	(working copy)
@@ -7441,7 +7441,8 @@ 
 @end table
 
 @subsubheading Remarks
-Using extended @code{asm} typically produces smaller, safer, and more
+Using extended @code{asm} (@pxref{Extended Asm}) typically produces smaller,
+safer, and more
 efficient code, and in most cases it is a better solution than basic
 @code{asm}.  However, there are two situations where only basic @code{asm}
 can be used:
@@ -7481,10 +7482,25 @@ 
 symbol errors during compilation if your assembly code defines symbols or 
 labels.
 
-Since GCC does not parse the @var{AssemblerInstructions}, it has no 
-visibility of any symbols it references. This may result in GCC discarding 
-those symbols as unreferenced.
+@strong{Warning:} The C standards do not specify semantics for @code{asm},
+making it a potential source of incompatibilities between compilers.  These
+incompatibilities may not produce compiler warnings/errors.
 
+GCC does not parse basic @code{asm}'s @var{AssemblerInstructions}, which
+means there is no way to communicate to the compiler what is happening
+inside them.  GCC has no visibility of symbols in the @code{asm} and may
+discard them as unreferenced.  It also does not know about side effects of
+the assembler code, such as modifications to memory or registers.  Unlike
+some compilers, GCC assumes that no changes to either memory or registers
+occur.  This assumption may change in a future release.
+
+To avoid complications from future changes to the semantics and the
+compatibility issues between compilers, consider replacing basic @code{asm}
+with extended @code{asm}.  See
+@uref{https://gcc.gnu.org/wiki/ConvertBasicAsmToExtended, How to convert
+from basic asm to extended asm} for information about how to perform this
+conversion.
+
 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