public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "martin at decky dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/48385] New: x86-64: Tail call recursion optimization with -mcmodel=large can generate invalid assembly (immediate operand illegal with absolute jump)
Date: Thu, 31 Mar 2011 13:06:00 -0000	[thread overview]
Message-ID: <bug-48385-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48385

           Summary: x86-64: Tail call recursion optimization with
                    -mcmodel=large can generate invalid assembly
                    (immediate operand illegal with absolute jump)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: martin@decky.cz


Created attachment 23836
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23836
Compiler result using -save-temps

When using -mcmodel=large and -O3, a tail call to an extern function can
generate an invalid assembly like in the following example:

    jmp *$memsetb

The correct assembly output should be perhaps:

    jmp *memsetb

The problem can be worked around by adding the "-fno-optimize-sibling-calls"
option to the compiler command line.


Output of /usr/local/cross/amd64/bin/amd64-linux-gnu-gcc -v:

Using built-in specs.
COLLECT_GCC=/usr/local/cross/amd64/bin/amd64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/usr/local/cross/amd64/libexec/gcc/amd64-linux-gnu/4.6.0/lto-wrapper
Target: amd64-linux-gnu
Configured with: /root/install/cross/amd64/gcc-4.6.0/configure
--target=amd64-linux-gnu --prefix=/usr/local/cross/amd64
--program-prefix=amd64-linux-gnu- --with-gnu-as --with-gnu-ld --disable-nls
--disable-threads --enable-languages=c,objc,c++,obj-c++ --disable-multilib
--disable-libgcj --without-headers --disable-shared --enable-lto
Thread model: single
gcc version 4.6.0 (GCC)


Command line that triggered the bug:

/usr/local/cross/amd64/bin/amd64-linux-gnu-gcc -DKERNEL -DRELEASE=0.4.3
"-DNAME=Sashimi" -D__64_BITS__ -D__LE__ -Igeneric/include -O3 -imacros
../config.h -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32LE
-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc -Wall
-Wextra -Wno-unused-parameter -Wmissing-prototypes
-Werror-implicit-function-declaration -Wwrite-strings -pipe -Werror -m64
-mcmodel=large -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
-march=opteron -Itest/  -mno-sse -mno-sse2  -c -o genarch/src/mm/page_pt.o
genarch/src/mm/page_pt.c


Compiler output:

{standard input}: Assembler messages:
{standard input}:722: Error: immediate operand illegal with absolute jump


             reply	other threads:[~2011-03-31 12:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31 13:06 martin at decky dot cz [this message]
2011-06-29 15:02 ` [Bug target/48385] " martin at decky dot cz
2011-06-30 16:03 ` martin at decky dot cz
2011-06-30 23:00 ` hjl.tools at gmail dot com
2011-06-30 23:01 ` hjl.tools at gmail dot com
2011-06-30 23:11 ` hjl.tools at gmail dot com
2011-07-01  2:54 ` martin at decky dot cz
2011-07-01  2:57 ` martin at decky dot cz
2012-11-07 19:48 ` mikpe at it dot uu.se
2012-11-08 10:24 ` martin at decky dot cz

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-48385-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: 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).