public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rob1weld at aol dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/31886] (different from bug report c/31077 and 29241) C handling of always_inline attribute error and a solution
Date: Thu, 02 Aug 2007 17:18:00 -0000	[thread overview]
Message-ID: <20070802171841.3989.qmail@sourceware.org> (raw)
In-Reply-To: <bug-31886-14209@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from rob1weld at aol dot com  2007-08-02 17:18 -------
I can confirm this too. Here is the bug report I was to post - but I searched
to see if this was already reported ;) - Here are my notes:

tree-inline.c - sorry, unimplemented: inlining failed ... function body not
available

When compiling the kernel with GCC version 4.3.0 20070630 or 20070716 it seems
to remove (optimize away) functions which are needed. When GCC later discovers
it needs the function afterall it crys "function body not available" and
terminates the build with an error. 

This does not occur if I add "-O0" on the end of the command line. :(

I also do not have this problem when using GCC version 4.2.1 20070628 .


http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.22-rc2.tar.bz2

make V=1 vmlinux

...
/usr/test/bin/gcc -Wp,-MD,kernel/.futex.o.d  -nostdinc -isystem
/usr/test/lib/gcc/i686-pc-linux-gnu/4.3.0/include -D__KERNEL__ -Iinclude
-Iinclude2 -Ilinux-2.6.22-rc2-source/include -include include/linux/autoconf.h
-Ilinux-2.6.22-rc2-source/kernel -Ikernel -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -O2 -fprofile-arcs
-ftest-coverage -D__arch_um__ -DSUBARCH=\"i386\"
-Ilinux-2.6.22-rc2-source/arch/um/include -Iarch/um/include 
-Ilinux-2.6.22-rc2-source/arch/um/include 
-Ilinux-2.6.22-rc2-source/arch/um/include/skas -Dvmap=kernel_vmap
-Din6addr_loopback=kernel_in6addr_loopback -march=k8
-mpreferred-stack-boundary=2 -ffreestanding -D_LARGEFILE64_SOURCE
-Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask -Dmktime=kernel_mktime
-U__i386__ -Ui386 -fno-unit-at-a-time -fno-omit-frame-pointer
-fno-optimize-sibling-calls -g -fno-stack-protector
-Wdeclaration-after-statement -Wno-pointer-sign  -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(futex)"  
-D"KBUILD_MODNAME=KBUILD_STR(futex)" -c -o kernel/.tmp_futex.o
linux-2.6.22-rc2-source/kernel/futex.c

linux-2.6.22-rc2-source/kernel/futex.c: In function 'futex_requeue_pi':
linux-2.6.22-rc2-source/kernel/futex.c:272: sorry, unimplemented: inlining
failed in call to 'get_futex_key_refs': function body not available
linux-2.6.22-rc2-source/kernel/futex.c:908: sorry, unimplemented: called from
here
make[2]: *** [kernel/futex.o] Error 1
make[1]: *** [kernel] Error 2
make: *** [vmlinux] Error 2
make: Leaving directory `linux-2.6.22-rc2-source'


The message comes from this file: gcc-4_3-trunk/gcc/tree-inline.c , line 2443:

          sorry ("inlining failed in call to %q+F: %s", fn, reason);
          sorry ("called from here");

and from here, /opt/gcc-4_3-trunk/gcc/diagnostic.def :
DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ")


The same problem occurs when compiling these files:
linux-2.6.22-rc2-source/mm/filemap.c
linux-2.6.22-rc2-source/fs/buffer.c
linux-2.6.22-rc2-source/fs/bio.c
linux-2.6.22-rc2-source/fs/block_dev.c
linux-2.6.22-rc2-source/fs/reiserfs/do_balan.c
linux-2.6.22-rc2-source/fs/reiserfs/namei.c
linux-2.6.22-rc2-source/fs/reiserfs/stree.c
linux-2.6.22-rc2-source/block/elevator.c
linux-2.6.22-rc2-source/block/ll_rw_blk.c
linux-2.6.22-rc2-source/net/ipv4/ip_output.c
linux-2.6.22-rc2-source/net/ipv4/igmp.c and
linux-2.6.22-rc2-source/include/net/dst.h
linux-2.6.22-rc2-source/net/ipv4/xfrm4_output.c and
linux-2.6.22-rc2-source/include/net/dst.h
linux-2.6.22-rc2-source/fs/udf/partition.c
linux-2.6.22-rc2-source/net/ipv4/ipvs/ip_vs_xmit.c
linux-2.6.22-rc2-source/net/ipv4/netfilter/nf_nat_rule.c
linux-2.6.22-rc2-source/net/ipv6/ip6_output.c
linux-2.6.22-rc2-source/net/ipv6/ip6_input.c
linux-2.6.22-rc2-source/net/ipv6/ndisc.c
linux-2.6.22-rc2-source/net/ipv6/mcast.c


I tried this line in the kernel Makefile but still got the same error message:
CFLAGS_futex.o += $(call cc-ifversion, -ge, 0403, -fno-inline)

I would have preferred if that had worked rather than resorting to "-O0" since
there are so many files affected by this issue.


I worked around this problem by editing
"linux-2.6.22-rc2-source/kernel/Makefile" (and all the other makefiles) by
adding this sort of line near the top of the Makefile:

CFLAGS_futex.o += $(call cc-ifversion, -ge, 0403, -O0)


That allows the kernel to build with GCC 4.3 but does not "fix" GCC itself.


Here is the minimum command line to trigger the problem:

gcc -O1 -fno-unit-at-a-time -c -o futex.o futex.i 
linux-2.6.22-rc2-source/kernel/futex.c: In function 'futex_requeue_pi':
linux-2.6.22-rc2-source/kernel/futex.c:272: sorry, unimplemented: inlining
failed in call to 'get_futex_key_refs': function body not available
linux-2.6.22-rc2-source/kernel/futex.c:908: sorry, unimplemented: called from
here

If I use "-O0" or leave off "-fno-unit-at-a-time" I don't get the error. These
options are what are present in the kernel's makefile (not my preferences). The
kernel's makefiles are written in a particular way to allow various other
features
to work (so a full overhaul of the all makefiles is out (for me)). If this is
not a problem with GCC 4.3 but instead an issue with the way Linux was written
then we can't expect to be compiling Linux with GCC 4.3 any time soon.


The kernel's makefile options do work with 4.2.1 and (recent) earlier versions
of GCC.


I will enclose the ".i" file.


-- 


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


  parent reply	other threads:[~2007-08-02 17:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-10  3:07 [Bug c/31886] New: " zhouyi04 at ios dot cn
2007-05-10  3:19 ` [Bug c/31886] " pinskia at gcc dot gnu dot org
2007-05-10  3:41 ` zhouzhouyi at ercist dot iscas dot ac dot cn
2007-05-10  3:43 ` zhouzhouyi at ercist dot iscas dot ac dot cn
2007-05-10  4:33 ` zhouyi04 at ios dot cn
2007-05-10 10:04 ` rguenth at gcc dot gnu dot org
2007-08-02 17:18 ` rob1weld at aol dot com [this message]
2007-08-02 17:24 ` rob1weld at aol dot com
2007-08-06  6:45 ` rob1weld at aol dot com
2007-08-06  8:41 ` zhouyi04 at ios dot cn
2007-08-20  7:58 ` rguenth at gcc dot gnu dot org
2009-01-13 22:10 ` rob1weld at aol dot com
2009-01-13 22:41 ` rguenth at gcc dot gnu dot org

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