public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48385] New: x86-64: Tail call recursion optimization with -mcmodel=large can generate invalid assembly (immediate operand illegal with absolute jump)
@ 2011-03-31 13:06 martin at decky dot cz
  2011-06-29 15:02 ` [Bug target/48385] " martin at decky dot cz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: martin at decky dot cz @ 2011-03-31 13:06 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2012-11-08 10:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-31 13:06 [Bug c/48385] New: x86-64: Tail call recursion optimization with -mcmodel=large can generate invalid assembly (immediate operand illegal with absolute jump) martin at decky dot cz
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

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