public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/65898] New: GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax
@ 2015-04-26 22:50 sstsoft at wp dot pl
  2015-04-26 22:56 ` [Bug inline-asm/65898] " sstsoft at wp dot pl
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: sstsoft at wp dot pl @ 2015-04-26 22:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65898

            Bug ID: 65898
           Summary: GCC puts auto generated code between two asm
                    volatile(".intel_syntax"); and asm
                    volatile(".att_syntax"); globally syntaxed rather than
                    not put or change it's syntax
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sstsoft at wp dot pl
  Target Milestone: ---

GCC put's code between asm volatile statements ended by new line
asm(".intel_syntax noprefix\n");
asm("mov eax,eax\n");
asm(".att_syntax\n");

so it's "auto generated" code is not well recognized by linker(?)
/APP
 # 515 "../../../some.cpp" 1
        .intel_syntax noprefix
 # 0 "" 2
        .loc 2 519 0
/NO_APP
        leal    -44(%ebp), %eax  #, tmp80
/APP
 # 519 "../../../some.cpp" 1
mov eax,%eax;    # tmp80

 # 0 "" 2
 # 519 "../../../some.cpp" 1
        .att_syntax
/NO_APP

When i write code without "\n" it's the same. I need to write in one asm();

1. GCC/GAS is not intuitive as could it be. 
Think it's little bug but then it's some kind of blocker!
2. When im forced to add .intel_syntax + code + .att_syntax at end there is a
problem with global flag -masm=intel and mixed syntaxes.
When .att code is mixed with intel asembly code global compiler flag could be
easy detected by #ifdef __INTEL_ASM and preprocessor so make decision of #ifdef
my .intel_syntaxed code with or without pre .intel statements. But if code is
mixed and pre stetemented i can't undef (change back to default syntax) because
rest of the auto generated GCC code would be ruined and not recognized.
If those statements are in one line asm() i must undef whole code either, and
this is specially when asm is in #define macro() because i can't put # in macro
 body. When i wrote asm volatile("att_syntax"); GCC sometimes put's some code
before it formated with global syntax flag and... you know what next:

"no such instruction: "


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug inline-asm/65898] GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax
  2015-04-26 22:50 [Bug inline-asm/65898] New: GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax sstsoft at wp dot pl
@ 2015-04-26 22:56 ` sstsoft at wp dot pl
  2015-04-26 23:16 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sstsoft at wp dot pl @ 2015-04-26 22:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65898

--- Comment #1 from stanley <sstsoft at wp dot pl> ---
You could see another bug there "mov eax,%eax" -> %eax is generated from named
value [val] "g" (val). I see there is my bug, to do such code without clobber
"eax" so GCC put's optimized local value into my asm inline() and almost nop ->
mov eax,eax produced.. i can fix that, but can someone fix bugs in GCC?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug inline-asm/65898] GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax
  2015-04-26 22:50 [Bug inline-asm/65898] New: GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax sstsoft at wp dot pl
  2015-04-26 22:56 ` [Bug inline-asm/65898] " sstsoft at wp dot pl
@ 2015-04-26 23:16 ` pinskia at gcc dot gnu.org
  2015-04-30 21:53 ` sstsoft at wp dot pl
  2015-05-01  7:08 ` schwab@linux-m68k.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-04-26 23:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65898

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is no GCC bug here.  You change the syntax without notifying GCC.  And
GCC is free to insert instructions between two inline-asms.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug inline-asm/65898] GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax
  2015-04-26 22:50 [Bug inline-asm/65898] New: GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax sstsoft at wp dot pl
  2015-04-26 22:56 ` [Bug inline-asm/65898] " sstsoft at wp dot pl
  2015-04-26 23:16 ` pinskia at gcc dot gnu.org
@ 2015-04-30 21:53 ` sstsoft at wp dot pl
  2015-05-01  7:08 ` schwab@linux-m68k.org
  3 siblings, 0 replies; 5+ messages in thread
From: sstsoft at wp dot pl @ 2015-04-30 21:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65898

stanley <sstsoft at wp dot pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #3 from stanley <sstsoft at wp dot pl> ---
(In reply to Andrew Pinski from comment #2)
> There is no GCC bug here.  You change the syntax without notifying GCC.  And
> GCC is free to insert instructions between two inline-asms.

No there IS A BUG. 
Have you reed it carefully?
I think you haven't (ok maybe i wrote it not so clear) 
The problem is that(i will repeat) - GCC put it's auto generated asm line(from
his C compilation process, it's not mine) between two of mine "hand made"
inline volatile asm's. Ok but why it's wrong? GCC uses wrong syntax, blind for
first line where i changed it. Ok maybe it's not a bug because for GCC each of
asm() is one "object". There are locals in each of them. Labels in each of them
etc. So also syntaxes should be threated separatly in each of them. 
It's a bug(not my mistake) because if i change .intel_syntax somewhere, this
line switches syntax globally, for all inline asms() puted below elswhere.
Problem is that not only for inline, for whole compilation process..is it a bug
in linker? I dont think so.
Maybe it's about /APP not #APP or something else? Maybe it's problem with
linker? I dont know, but it's far way from OK, and GCC generates it. It's close
to very BIG problem. 

One my asm block changes .intel syntax, second does something, third changes
syntax back to default instead of one multiline asm that does it without
problem. The first changes (as you mentioned) syntax without notifying GCC and
that is the problem. So GCC put's it's code in wrong syntax between two of
mine. Is't not a BUG? Really?
I think less code lines would change this bug than i wrote about it.. 
But need person who well knows it's code.

For now, .s postprocessor - linker(?) rises an error, stupid/blind GCC puted
some stupid code after that line i need omited problem of three asm() with
string #define. Haven't found auto definition such as exists for __SSE__ or
__MMX__ that is "activated" when -mmmx or -msse is passed to gcc command line.
Omitted problem of -masm=intel(witch could be wrong scenario with code ended by
".att_syntax") with -DGCC_SYNTAX=".intel_syntax" + -masm=intel after each mine
init ".intel_syntax" instead of turning it off to att code is passing
GCC_SYNTAX=".intel_syntax" define as string, at end of my inline blocks.
Automation of this proces is guaranted by well formated makefile, use of define
in macro is plausible and everybody happy. I suppose there is such #define
generated by GCC but i cant find it nowhere. Mentioned previous, about it but
it was some man propose for code, not definition from GCC. If You could help me
to figure out name for __INTEL_SYNTAX__(if there is such "#define") i would
appreciate it. 

BTW3. I know there is lot of __buildin_mm_nameit functions, so inline asm is
useless..(someone else done hard work). Secondly i have found -save-temps(debug
of asm is working now like charm) i have learned how to write .s assembly and
figured out "offline" GAS is even better, simpler than NASM, YASM, FASM and
SASM. But, why to learn linker nameing conventions _ZN6blablav@i  when you
could have C generated names, namespaces, __stdcalls etc. as simple as in MS VS
on inline asm.. that's why i need it. 
So i've made past week some cool stuff and named it __stasm :)
New way of using asm made in C preprocessor(learned some cool stuff from GNU
about preprocessor), I will public it very soon.
It's very very qool thing i hope so ;) But i not hope for GNU guys :)

+ There is some other bugs i will report soon. Really BUGS in PTR[] offsets for
intel syntax(that's not working at all, but in att are working well) 
I hope __stasm(Stanley asm) would be very cool even with those bugs, almost the
same form as Microsoft asm {} and there is no need to patch gcc, there is only
need for C preprocessor :) 

Force with you bro. Sory for spamer mode, sory for my previous bugreport, im
shamed of it but not for this.
Cheers.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug inline-asm/65898] GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax
  2015-04-26 22:50 [Bug inline-asm/65898] New: GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax sstsoft at wp dot pl
                   ` (2 preceding siblings ...)
  2015-04-30 21:53 ` sstsoft at wp dot pl
@ 2015-05-01  7:08 ` schwab@linux-m68k.org
  3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2015-05-01  7:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65898

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
There is no way for GCC to know the meaning or effect of your hand crafted asm
statements.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-01  7:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26 22:50 [Bug inline-asm/65898] New: GCC puts auto generated code between two asm volatile(".intel_syntax"); and asm volatile(".att_syntax"); globally syntaxed rather than not put or change it's syntax sstsoft at wp dot pl
2015-04-26 22:56 ` [Bug inline-asm/65898] " sstsoft at wp dot pl
2015-04-26 23:16 ` pinskia at gcc dot gnu.org
2015-04-30 21:53 ` sstsoft at wp dot pl
2015-05-01  7:08 ` schwab@linux-m68k.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).