From: Bernd Schmidt <bschmidt@redhat.com>
To: David Wohlferd <dw@LimeGreenSocks.com>,
Bernd Edlinger <bernd.edlinger@hotmail.de>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Henderson <rth@redhat.com>,
"jason@redhat.com" <jason@redhat.com>
Cc: "segher@kernel.crashing.org" <segher@kernel.crashing.org>,
"sandra@codesourcery.com" <sandra@codesourcery.com>,
"Paul_Koning@Dell.com" <Paul_Koning@Dell.com>,
Jeff Law <law@redhat.com>, Andrew Haley <aph@redhat.com>
Subject: Re: AW: Wonly-top-basic-asm
Date: Fri, 12 Feb 2016 12:51:00 -0000 [thread overview]
Message-ID: <56BDD550.3050908@redhat.com> (raw)
In-Reply-To: <56BD8427.4050405@LimeGreenSocks.com>
On 02/12/2016 08:05 AM, David Wohlferd wrote:
> Actually, it was my intent that this apply to v6. It's not like there
> is a significant change here. We're documenting long-time behavior, and
> adding a (disabled) warning.
The doc patch (minus mentioning the warning) could go in now, but for
gcc-6 we're at a stage where we're only accepting regression fixes with
very few exceptions. If you can convince a RM that this is important
enough then it could still go in.
> 2) There is a significant change to this behavior being proposed for
> v7. When this happens, having a way to locate affected statements with
> features from a stable release seems desirable.
I'm actually not convinced that we'll want to change much in asm
behaviour. Clobbering memory, maybe, but I can't see much beyond that -
there's just no gain and some risk. So I'm a little more relaxed about
the whole thing.
>> "Since the C standards does not specify semantics for @code{asm}, it
>> is a potential source of incompatibilities between compilers. GCC does
>> not parse the @var{AssemblerInstructions}, which means there is no way
>> to communicate to the compiler what is happening inside them. GCC has
>> no visibility of any symbols referenced in the @code{asm} and may
>> discard them as unreferenced. It also does not know about side effects
>> that may occur, such as modifications of memory locations or
>> registers. GCC assumes that no such side effects occur, which may not
>> be what the user expected if code was written for other compilers.
>>
>> Since basic @code{asm} cannot easily be used in a reliable way,
>> @option{-Wbasic-asm} should be used to warn about the use of basic asm
>> inside a function. See
>> @uref{https://gcc.gnu.org/wiki/ConvertBasicAsmToExtended, How to
>> convert from basic asm to extended asm} for information about how to
>> convert code to use extended @code{asm}."
>
> Hmm. Yes, that's better. But there are some things that got lost here
> that I think are important. How about:
>
> ------------
> @strong{Warning:} The C standards do not specify semantics for
> @code{asm}, making it a potential source of incompatibilities between
> compilers. @code{asm} statements that work correctly on other compilers
> may not work correctly with GCC (and vice versa), even though both
> compile without error.
This is what I mean when I say "too verbose" - the second sentence
essentially says exactly the same thing as the first. The repetition is
unnecessary, and I'd drop it.
> 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, use @option{-Wbasic-asm} to warn
> about the use of basic asm inside a function. See
> @uref{https://gcc.gnu.org/wiki/ConvertBasicAsmToExtended, How to convert
> from basic asm to extended asm} for information about how to convert
> code to use extended @code{asm}.
Other than that they look quite similar, and I think your new suggestion
is good too. Let's let Sandra have the last word.
Bernd
next prev parent reply other threads:[~2016-02-12 12:51 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-24 22:24 Wonly-top-basic-asm David Wohlferd
2016-01-25 12:25 ` Wonly-top-basic-asm Bernd Schmidt
2016-01-28 7:21 ` Wonly-top-basic-asm David Wohlferd
2016-02-08 3:46 ` Wonly-top-basic-asm David Wohlferd
2016-02-08 6:45 ` AW: Wonly-top-basic-asm Bernd Edlinger
2016-02-08 20:15 ` David Wohlferd
2016-02-10 23:50 ` David Wohlferd
2016-02-11 6:51 ` AW: " Bernd Edlinger
2016-02-12 7:01 ` David Wohlferd
2016-02-11 15:40 ` Bernd Schmidt
2016-02-11 16:03 ` Sandra Loosemore
2016-02-12 7:08 ` David Wohlferd
2016-02-12 7:05 ` David Wohlferd
2016-02-12 12:51 ` Bernd Schmidt [this message]
2016-02-13 1:03 ` Sandra Loosemore
2016-02-14 4:00 ` David Wohlferd
2016-02-20 1:03 ` David Wohlferd
2016-02-20 12:08 ` Wonly-top-basic-asm Bernd Edlinger
2016-02-21 10:28 ` Wonly-top-basic-asm David Wohlferd
2016-02-26 15:10 ` Wonly-top-basic-asm Bernd Schmidt
2016-02-29 7:02 ` Wonly-top-basic-asm David Wohlferd
2016-03-11 0:56 ` Wonly-top-basic-asm David Wohlferd
2016-03-14 15:29 ` Wonly-top-basic-asm Bernd Schmidt
2016-03-17 5:24 ` Wonly-top-basic-asm David Wohlferd
2016-03-18 13:32 ` Wonly-top-basic-asm Bernd Schmidt
2016-03-18 15:01 ` Wonly-top-basic-asm Richard Biener
2016-03-18 19:14 ` Wonly-top-basic-asm Bernd Schmidt
2016-02-14 3:57 ` AW: Wonly-top-basic-asm David Wohlferd
2016-01-26 0:32 ` Wonly-top-basic-asm Segher Boessenkool
2016-01-26 12:11 ` Wonly-top-basic-asm Bernd Schmidt
2016-01-26 16:12 ` Wonly-top-basic-asm Segher Boessenkool
2016-01-26 23:38 ` Wonly-top-basic-asm David Wohlferd
2016-02-16 14:03 ` Wonly-top-basic-asm Jan Hubicka
2016-02-16 20:02 ` Wonly-top-basic-asm Bernd Edlinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56BDD550.3050908@redhat.com \
--to=bschmidt@redhat.com \
--cc=Paul_Koning@Dell.com \
--cc=aph@redhat.com \
--cc=bernd.edlinger@hotmail.de \
--cc=dw@LimeGreenSocks.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=law@redhat.com \
--cc=rth@redhat.com \
--cc=sandra@codesourcery.com \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).