From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 130805 invoked by alias); 26 Apr 2015 22:11:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 130785 invoked by uid 48); 26 Apr 2015 22:11:26 -0000 From: "sstsoft at wp dot pl" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: blocker X-Bugzilla-Who: sstsoft at wp dot pl 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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-04/txt/msg02230.txt.bz2 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.