public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/67301] New: Unable to compile program using extended assembly and asmSymbolicName
@ 2015-08-21 4:44 noloader at gmail dot com
2015-08-21 5:11 ` [Bug driver/67301] " noloader at gmail dot com
2015-08-21 9:01 ` [Bug inline-asm/67301] " rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: noloader at gmail dot com @ 2015-08-21 4:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67301
Bug ID: 67301
Summary: Unable to compile program using extended assembly and
asmSymbolicName
Product: gcc
Version: 4.9.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: noloader at gmail dot com
Target Milestone: ---
The following program:
$ cat test.cxx
int main(int argc, char* argv[])
{
__asm__ __volatile__ (
"\t movl %[__ARGC], %%eax \n"
:
: __ARGC "" (argc)
);
return 0;
}
Results in a failed compile:
$ g++ test.cxx
test.cxx: In function ‘int main(int, char**)’:
test.cxx:7:5: error: expected string-literal before ‘__ARGC’
: __ARGC "" (argc)
^
test.cxx:7:5: error: expected ‘(’ before ‘__ARGC’
test.cxx:7:5: error: ‘__ARGC’ was not declared in this scope
test.cxx:7:12: error: expected ‘)’ before string constant
: __ARGC "" (argc)
^
test.cxx:7:12: error: expected ‘)’ before string constant
Above, I am trying to use GCC's extended ASM like Microsoft's MASM.
According to the online manual and Assembler Instructions with C Expression
Operands, § 6.44.3.1 Input Operands
(https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html), asmSymbolicName is
being used correctly.
Operands are separated by commas. Each operand has this format:
[ [asmSymbolicName] ] constraint (cexpression)
asmSymbolicName
Specifies a symbolic name for the operand. Reference the name in the
assembler template by enclosing it in square brackets (i.e. ‘%[Value]’).
The scope of the name is the asm statement that contains the definition.
Any valid C variable name is acceptable, including names already defined
in the surrounding code.
>From gcc-bugs-return-495319-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Aug 21 05:06:10 2015
Return-Path: <gcc-bugs-return-495319-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31883 invoked by alias); 21 Aug 2015 05:04:26 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31842 invoked by uid 48); 21 Aug 2015 05:04:18 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug driver/67301] Unable to compile program using extended assembly and asmSymbolicName
Date: Fri, 21 Aug 2015 05:04:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: driver
X-Bugzilla-Version: 4.9.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-67301-4-PsiMhPveNX@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67301-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67301-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-08/txt/msg01461.txt.bz2
Content-length: 582
https://gcc.gnu.org/bugzilla/show_bug.cgi?idg301
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Try:
int main(int argc, char* argv[])
{
__asm__ __volatile__ (
"\t movl %[__ARGC], %%eax \n"
:
: [__ARGC] "r" (argc)
);
return 0;
}
Basically the syntax for naming operands is [XYZ] but since it is optional, [
is used to say it is optional part of the syntax. Yes it is slightly confusing
but that is what you get when you use [] as both part of the actual syntax and
saying it is an optional part.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug driver/67301] Unable to compile program using extended assembly and asmSymbolicName
2015-08-21 4:44 [Bug driver/67301] New: Unable to compile program using extended assembly and asmSymbolicName noloader at gmail dot com
@ 2015-08-21 5:11 ` noloader at gmail dot com
2015-08-21 9:01 ` [Bug inline-asm/67301] " rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: noloader at gmail dot com @ 2015-08-21 5:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67301
--- Comment #2 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Try:
> int main(int argc, char* argv[])
> {
> __asm__ __volatile__ (
>
> "\t movl %[__ARGC], %%eax \n"
> :
> : [__ARGC] "r" (argc)
> );
>
> return 0;
> }
>
> Basically the syntax for naming operands is [XYZ] but since it is optional,
> [ is used to say it is optional part of the syntax. Yes it is slightly
> confusing but that is what you get when you use [] as both part of the
> actual syntax and saying it is an optional part.
Oh, I see. Yes, that's confusing.
When I read it, I thought the double square brackets were a typo that should
have read something like the following, meaning the asmSymbolicName is optional
(which it is):
[ [asmSymbolicName] constraint (cexpression) ]
Perhaps the docs should call that out specifically to avoid confusion?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug inline-asm/67301] Unable to compile program using extended assembly and asmSymbolicName
2015-08-21 4:44 [Bug driver/67301] New: Unable to compile program using extended assembly and asmSymbolicName noloader at gmail dot com
2015-08-21 5:11 ` [Bug driver/67301] " noloader at gmail dot com
@ 2015-08-21 9:01 ` rguenth at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-08-21 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67301
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |documentation
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-21
Component|driver |inline-asm
Ever confirmed|0 |1
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed as documentation issue.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-21 9:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 4:44 [Bug driver/67301] New: Unable to compile program using extended assembly and asmSymbolicName noloader at gmail dot com
2015-08-21 5:11 ` [Bug driver/67301] " noloader at gmail dot com
2015-08-21 9:01 ` [Bug inline-asm/67301] " rguenth at gcc dot gnu.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).