From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14179 invoked by alias); 23 Oct 2003 00:45:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14172 invoked by uid 48); 23 Oct 2003 00:45:55 -0000 Date: Thu, 23 Oct 2003 00:46:00 -0000 From: "geoffk at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20031023004550.12738.geoffk@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/12738] New: Missing function with 'static' declaration inside function. X-Bugzilla-Reason: CC X-SW-Source: 2003-10/txt/msg01991.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12738 Summary: Missing function with 'static' declaration inside function. Product: gcc Version: 3.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: geoffk at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: powerpc-darwin GCC host triplet: powerpc-darwin GCC target triplet: powerpc-darwin The following testcase: void flarm(void) { static void foo(); foo(); } static void foo(void) { } produces a linker error when compiled with -funit-at-a-time and IMA, because 'foo' is not output although a reference to it is. Interestingly, it *does* work if you disable either of these. The actual command-line I used was ./xgcc -B./ ~/t.c ~/t2.c -S -O -o t.s -funit-at-a-time with 't.c' containing the above, and 't2.c' containing: int xxx; and the assembler output I got was: .text .align 2 .globl _flarm _flarm: mflr r0 stw r31,-4(r1) stw r0,8(r1) stwu r1,-80(r1) bl _foo.1 addi r1,r1,80 lwz r0,8(r1) mtlr r0 lwz r31,-4(r1) blr .comm _xxx,4 No 'foo' :-(. (This syntax is a GCC extension, and not a very good one; but I bet there's some other case that can trip the underlying bug.) I expect at least part of the problem is that we have DECL_EXTERNAL and ! TREE_PUBLIC.