This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/13842] New: static inline erroneously emitted


static inline functions are not emitted if they are not referenced.
The following case may fall on the boundary, however it use to work
(e.g. in gcc 2.96) and it works in gcc 3.4, so I'm guessing this is
a regression in the 3.3 branch.
I was able to recreate the problem with the current head of the gcc-3_3-branch
branch.

Consider:

static inline int foo (void);

static inline int
foocaller (void)
{
    return foo ();
}

extern int bar (void);

extern int blah;

static inline int
foo (void)
{
    return bar ();
}

int
lala (void)
{
    return blah;
}

bash$ gcc-3.3.3 -c -O2 -fno-inline foo.c
bash$ nm foo.o
         U bar
         U blah
00000000 t foo
0000000c T lala

Note that `foo' has been emitted.
[which isn't that big a deal except that an undefined reference has
also been emitted that didn't get emitted before]

Again, given the presence of -fno-inline,
whether y'all want to declare this a bug or not is up for discussion
I guess.  However, this use to work, and it works in the gcc 3.4 branch,
thus I'm guessing this is a regression.
[where "works" means `foo' and the undefined reference to `bar' do
not get emitted]

-- 
           Summary: static inline erroneously emitted
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dje at transmeta dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]