This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using the asm suffix


On Wed, Aug 19, 2015 at 11:02:14PM -0700, David Wohlferd wrote:
> >>how about replacing the existing
> >>text ("It does not make sense to use this feature with a non-static
> >>local variable since such variables do not have assembler names.") with
> >>"Do not use this feature with a non-static local variable." or maybe "It
> >>is not supported to use this feature with a non-static local variable
> >>since such variables do not have assembler names."
> >"You cannot use this feature ..." etc.?  Keep the part about not having
> >assembler names, it is useful.
> 
> Due to the quirks of the English language, I'm not sure 'cannot' is the 
> right word here.  More correct would be 'cannot reliably' but I don't 
> want to be that wishy-washy.
> 
> And I'm a little iffy about the 'since such variables do not have 
> assembler names,' as it seemed a bit bold to make assertions about the 
> implementation details for all assemblers (past, present and future) for 
> all platforms.  But you are right, it does convey a bit of the 'why' for 
> this limitation, so keeping it is a good idea.  How about:

I think "cannot" is the correct word; this is not about what assemblers
do at all, but about what the *compiler* does.  It would have to jump
through hoops to be able to give stack vars a name; or not use stack
vars, even worse :-)

> "gcc does not support using this feature with a non-static local 
> variable since typically such variables do not have assembler names."

[spelling "GCC" correctly, of course...]

Get rid of "typically" and this looks fine.

> BTW, the trick for getting the "ignoring asm-specifier for non-static 
> local variable" message was renaming my file from sta5.cpp to sta5.c.  
> Seems like this should apply to both, but whatever.

Huh, strange.  Please file a PR.

> >>>The first part ("must not use a register name") is an important warning.
> >>Clarifying this is a good idea.  Although limiting it to only saying
> >>"don't use register names" seems a little, well, limiting. Who knows
> >>what kind of offsets or asm qualifiers they might try to cram in here?
> >Register names is the common case to hurt you...  "r0" etc. ;-)
> 
> But as we have seen (%gs:4), people are willing to try other things.  
> And rather than try to list all the things that don't work (register, 
> registers with offsets, etc), I'm hoping we can find a way to specify 
> the one thing that is supported.

It already says what is supported: a valid name.  "(%gs:4)" is not, "r0"
is, with most assemblers.  This is one reason why some systems prefix
all C symbols with an underscore.


Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]