[cfe-dev] [PATCH] Function redeclaration and PR2360
Eli Friedman
eli.friedman at gmail.com
Sun May 25 02:32:23 PDT 2008
The issue in PR2360 (http://llvm.org/bugs/show_bug.cgi?id=2360) is
essentially that the destruction sees the first function definition
multiple times, so the program essentially crashes trying to free it
twice. The first function definition is seen multiple times because
of the funny rearrangements that
This patch rearranges things so that each top-level declaration is
added to the scope in the usual way, rather than messing with the old
declaration. This means that references to a function before a
redeclaration refer to the old declaration, and references to a
function after a redeclaration refer to the new declaration. The
original arrangement where the old declaration was rearranged to look
like new declaration was done in r50021; however, that rearrangement
isn't needed to fix the original bug (test/Sema/redefinition.c).
A nice side effect of this patch is that it makes the representation
of function declarations in the AST more faithful to the original
source, which might be useful for other purposes.
I know there was an extremely long mailing list discussion related to
this stuff, but I'm not entirely sure if any of it is relevant to this
patch.
There's one regression that I found with this patch relating to
codegen of static forward declarations, but I don't think it's
actually a bug in my patch; I'll have to study it a bit more, and I'll
check in a fix for that separately before I check this in.
-Eli
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: t.txt
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080525/647386ec/attachment.txt>
More information about the cfe-dev
mailing list