public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "valery_reznic at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug inline-asm/39078] Registers in on clober list are cloberred when compiled with optimization  (x86_64) ?
Date: Mon, 09 Feb 2009 16:08:00 -0000	[thread overview]
Message-ID: <20090209160750.10882.qmail@sourceware.org> (raw)
In-Reply-To: <bug-39078-17264@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2009-02-09 16:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 16:54 [Bug inline-asm/39078] New: " 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
2009-02-09 16:08 ` valery_reznic at yahoo dot com [this message]
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
2009-02-11 15:32 ` ubizjak at gmail dot com
2009-02-11 15:56 ` valery_reznic at yahoo dot com

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=20090209160750.10882.qmail@sourceware.org \
    --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: link
Be 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).