public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sstsoft at wp dot pl" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/65897] New: GAS named variable of extended asm (::"m" or "g") is in wrong code style, variable stays still in ".att_syntax" -32(%ebp) not ".intel_syntax noprefix" DWORD PTR [ebp-0x20] while rest of the code is switched on corectly Date: Sun, 26 Apr 2015 22:11:00 -0000 [thread overview] Message-ID: <bug-65897-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65897 Bug ID: 65897 Summary: GAS named variable of extended asm (::"m" or "g") is in wrong code style, variable stays still in ".att_syntax" -32(%ebp) not ".intel_syntax noprefix" DWORD PTR [ebp-0x20] while rest of the code is switched on corectly Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: blocker Priority: P3 Component: inline-asm Assignee: unassigned at gcc dot gnu.org Reporter: sstsoft at wp dot pl Target Milestone: --- GNU Asembler version 2.32.2 GCC 4.8.1 QT Creator 5.3.1 "g++ -c -fno-keep-inline-dllexport -save-temps -Wattributes -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -v -momit-leaf-frame-pointer -os -Wno-write-strings -Wno-unused-variable -Wno-unused-parameter -Wno-unused-label -Wno-unused-value -Wunknown-pragmas -std=gnu++0x -pthread -fopenmp -fverbose-asm -g -std=c++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB ..." simple code as below: int val; asm volatile (".INTEL_SYNTAX noprefix\n mov eax,%[val]\n" :: [val] "g" [&val] asm volatile (".ATT_SYNTAX\n"); is compiled into-> mov eax,-32(%ebp) rather than correct version for Intel syntax: -> mov eax,DWORD PTR[ebp-0x20] First of all i thunk it was capital problem (INTEL not .intel) but it's not. BTW. Why generated /APP /NO_APP rather than #APP #NO_APP? When i switch on -masm=intel globally and disable .intel_syntax in my inline asm() it compiles whole code correctly(as above). When I make ATT code after asm(".att_syntax\n movl -32(%ebp),%eax\n" :: [val] "g" (&val)); + .intel switched globaly ON, code generated for val stays in "att" so, no error produced, compilation successed. It's happens either when syntax is double changed into one asm() statement, 2 statements(as posted), or three .intel + code + .att, Code .s for named variable is always formated wrong (as default in ATT mode). Any other code even with global variables is produced okey, asembler code is working but not when i add named variable (extended assembly). Even if gcc optimizes val into registry, produces %eax rather than eax output so it must be a bug not a feature. I know there is =r, r mode. But for me it's bad that GCC don't know what register names im using in inline asembly, GAS it's not. Named variables it's only way to force asm for using locals, "g" mode, #__VA_ARGS__ myasm() = myasm_vars() defs is the only way for simpler ported code. Bug is well known by others: http://gotoanswer.com/?q=GCC+inline+assembly+error%3A+Error%3A+junk+%60%28%25esp%29%27+after+expression https://www.c-plusplus.net/forum/106506-full http://stackoverflow.com/questions/13856792/gcc-inline-assembly-error-error-junk-esp-after-expression Sorry, english is not my primary language.
next reply other threads:[~2015-04-26 22:11 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-04-26 22:11 sstsoft at wp dot pl [this message] 2015-04-26 22:40 ` [Bug inline-asm/65897] GAS(asm) "named variable" of extended asm (type ::"m" or "g") generated in wrong code style, variable stays still in ".att_syntax" -32(%ebp) not ".intel_syntax noprefix" DWORD PTR [ebp-0x20] while rest of the code is switched on correctly to Intel pinskia at gcc dot gnu.org 2015-05-12 19:30 ` sstsoft at wp dot pl
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=bug-65897-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe 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).