This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/12738] New: Missing function with 'static' declaration inside function.
- From: "geoffk at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Oct 2003 00:45:55 -0000
- Subject: [Bug c/12738] New: Missing function with 'static' declaration inside function.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.