This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/29484] [4.0/4.1/4.2 Regression] tree-inline.c bug with local static vars
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2006 18:42:04 -0000
- Subject: [Bug tree-optimization/29484] [4.0/4.1/4.2 Regression] tree-inline.c bug with local static vars
- References: <bug-29484-87@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from jakub at gcc dot gnu dot org 2006-10-16 18:42 -------
Actually, even C generates one static var for all the inlined functions (in C
within one object), so I'd say we just should mark functions containing
local static variables with &&label in their initializers as non-inlinable,
because anything else means we can't use the same variable for more than
one inlined copy of the function.
In that light the original testcase would just issue an error, as always_inline
function can't be inlined, but e.g.
void baz (unsigned long *);
static inline
void bar (void)
{
addr:;
static unsigned long b = (unsigned long) &&addr;
baz (&b);
}
void
f1 (void)
{
bar ();
}
void
f2 (void)
{
bar ();
}
would be a valid testcase that we don't handle properly.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29484