* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
@ 2009-02-06 1:43 ` pinskia at gcc dot gnu dot org
2009-02-06 7:12 ` valery_reznic at yahoo dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-06 1:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-02-06 01:42 -------
r11 is saved by the caller so this is the generated code is valid.
Since nothing else uses r11 in the inline-asm, the code is correct.
>From the i386.h header:
The value is zero if the register is not call used on either 32 or
64 bit targets, one if the register if call used on both 32 and 64
bit targets, two if it is only call used on 32bit targets and three
if its only call used on 64bit targets.
/* r8, r9, r10, r11, r12, r13, r14, r15*/ \
1, 1, 1, 1, 2, 2, 2, 2, \
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
GCC host triplet|file bb.c |file bb.c
|============================|
|========================= |
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
2009-02-06 1:43 ` [Bug inline-asm/39078] " pinskia at gcc dot gnu dot org
@ 2009-02-06 7:12 ` valery_reznic at yahoo dot com
2009-02-06 11:51 ` ubizjak at gmail dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: valery_reznic at yahoo dot com @ 2009-02-06 7:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from valery_reznic at yahoo dot com 2009-02-06 07:12 -------
(In reply to comment #1)
> r11 is saved by the caller so this is the generated code is valid.
> Since nothing else uses r11 in the inline-asm, the code is correct.
The problem is not that r11 not saved at stack, but that saved on the stack
value of r15 ALWAYS will be overwritten - by the 'call my_syscall' instruction
and saved on the stack values of rbx, r12, r13 and r14 MAY BE overritten if
my_syscall function wrote something to the stack
> From the i386.h header:
> The value is zero if the register is not call used on either 32 or
> 64 bit targets, one if the register if call used on both 32 and 64
> bit targets, two if it is only call used on 32bit targets and three
> if its only call used on 64bit targets.
> /* r8, r9, r10, r11, r12, r13, r14, r15*/ \
> 1, 1, 1, 1, 2, 2, 2, 2, \
>
--
valery_reznic at yahoo dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
2009-02-06 1:43 ` [Bug inline-asm/39078] " pinskia at gcc dot gnu dot org
2009-02-06 7:12 ` valery_reznic at yahoo dot com
@ 2009-02-06 11:51 ` ubizjak at gmail dot com
2009-02-06 12:08 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2009-02-06 11:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from ubizjak at gmail dot com 2009-02-06 11:51 -------
> > r11 is saved by the caller so this is the generated code is valid.
> > Since nothing else uses r11 in the inline-asm, the code is correct.
> The problem is not that r11 not saved at stack, but that saved on the stack
> value of r15 ALWAYS will be overwritten - by the 'call my_syscall' instruction
> and saved on the stack values of rbx, r12, r13 and r14 MAY BE overritten if
> my_syscall function wrote something to the stack
These values have been saved into red-zone area. Since gcc does not know that
you have a call in the asm it thinks that func_1 is a leaf function where
redzone area can be used for temporary storage.
You can use -mno-red-zone to disable red-zone, but in reality, you should not
call other functions from inside asm.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (2 preceding siblings ...)
2009-02-06 11:51 ` ubizjak at gmail dot com
@ 2009-02-06 12:08 ` jakub at gcc dot gnu dot org
2009-02-09 16:08 ` valery_reznic at yahoo dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-02-06 12:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2009-02-06 12:08 -------
Or you can subq $128, %rsp; call my_syscall; addq $128, %rsp in your inline
assembly.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (3 preceding siblings ...)
2009-02-06 12:08 ` jakub at gcc dot gnu dot org
@ 2009-02-09 16:08 ` valery_reznic at yahoo dot com
2009-02-09 16:09 ` valery_reznic at yahoo dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: valery_reznic at yahoo dot com @ 2009-02-09 16:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from valery_reznic at yahoo dot com 2009-02-09 16:07 -------
(In reply to comment #3)
> > > r11 is saved by the caller so this is the generated code is valid.
> > > Since nothing else uses r11 in the inline-asm, the code is correct.
> > The problem is not that r11 not saved at stack, but that saved on the stack
> > value of r15 ALWAYS will be overwritten - by the 'call my_syscall' instruction
> > and saved on the stack values of rbx, r12, r13 and r14 MAY BE overritten if
> > my_syscall function wrote something to the stack
>
> These values have been saved into red-zone area. Since gcc does not know that
> you have a call in the asm it thinks that func_1 is a leaf function where
> redzone area can be used for temporary storage.
>
> You can use -mno-red-zone to disable red-zone, but in reality, you should not
> call other functions from inside asm.
>
Aha, no I realized why compiler is right. Still if it will mentioned in the
gcc's docs about inline assembler it will be nice.
Any why you say I shouldn't call other function from inside asm ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (4 preceding siblings ...)
2009-02-09 16:08 ` valery_reznic at yahoo dot com
@ 2009-02-09 16:09 ` valery_reznic at yahoo dot com
2009-02-11 7:50 ` ubizjak at gmail dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: valery_reznic at yahoo dot com @ 2009-02-09 16:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from valery_reznic at yahoo dot com 2009-02-09 16:09 -------
(In reply to comment #4)
> Or you can subq $128, %rsp; call my_syscall; addq $128, %rsp in your inline
> assembly.
>
When I understood what happened I did it, but thank you anyway.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (5 preceding siblings ...)
2009-02-09 16:09 ` valery_reznic at yahoo dot com
@ 2009-02-11 7:50 ` ubizjak at gmail dot com
2009-02-11 14:26 ` valery_reznic at yahoo dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2009-02-11 7:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from ubizjak at gmail dot com 2009-02-11 07:50 -------
(In reply to comment #5)
> Any why you say I shouldn't call other function from inside asm ?
See for example [1].
[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16331#c14
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (6 preceding siblings ...)
2009-02-11 7:50 ` ubizjak at gmail dot com
@ 2009-02-11 14:26 ` valery_reznic at yahoo dot com
2009-02-11 15:32 ` ubizjak at gmail dot com
2009-02-11 15:56 ` valery_reznic at yahoo dot com
9 siblings, 0 replies; 11+ messages in thread
From: valery_reznic at yahoo dot com @ 2009-02-11 14:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from valery_reznic at yahoo dot com 2009-02-11 14:26 -------
(In reply to comment #7)
> (In reply to comment #5)
>
> > Any why you say I shouldn't call other function from inside asm ?
>
> See for example [1].
>
> [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16331#c14
>
I read it. Still I don't get the point.
In the inline assembler I MYSELF put arguments in the places where MY (by the
way, written in assembler) function expect to get them.
I need nothing from gcc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (7 preceding siblings ...)
2009-02-11 14:26 ` valery_reznic at yahoo dot com
@ 2009-02-11 15:32 ` ubizjak at gmail dot com
2009-02-11 15:56 ` valery_reznic at yahoo dot com
9 siblings, 0 replies; 11+ messages in thread
From: ubizjak at gmail dot com @ 2009-02-11 15:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from ubizjak at gmail dot com 2009-02-11 15:32 -------
(In reply to comment #8)
> In the inline assembler I MYSELF put arguments in the places where MY (by the
> way, written in assembler) function expect to get them.
Then you actually don't need a compiler... ;)
> I need nothing from gcc.
True.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization (x86_64) ?
2009-02-02 16:54 [Bug inline-asm/39078] New: Registers in on clober list are cloberred when compiled with optimization (x86_64) ? valery_reznic at yahoo dot com
` (8 preceding siblings ...)
2009-02-11 15:32 ` ubizjak at gmail dot com
@ 2009-02-11 15:56 ` valery_reznic at yahoo dot com
9 siblings, 0 replies; 11+ messages in thread
From: valery_reznic at yahoo dot com @ 2009-02-11 15:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from valery_reznic at yahoo dot com 2009-02-11 15:56 -------
(In reply to comment #9)
> (In reply to comment #8)
>
> > In the inline assembler I MYSELF put arguments in the places where MY (by the
> > way, written in assembler) function expect to get them.
>
> Then you actually don't need a compiler... ;)
My assembler code is inline. It's surrounded by fairly large amount of the C
code, so I need compiler. I just don't care if it know how to pass arguments to
my function - I do it myself (and it work)
So could you please explain why you said that I shouldn't use 'call' inside
inline asm ?
>
> > I need nothing from gcc.
>
> True.
I mean "I don't need it to know how pass args to my function"
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39078
^ permalink raw reply [flat|nested] 11+ messages in thread