[llvm-commits] [llvm-gcc-4.2] r63306 - /llvm-gcc-4.2/trunk/gcc/tree-nested.c

Duncan Sands baldrick at free.fr
Thu Jan 29 05:25:10 PST 2009


Author: baldrick
Date: Thu Jan 29 07:25:08 2009
New Revision: 63306

URL: http://llvm.org/viewvc/llvm-project?rev=63306&view=rev
Log:
Yes, we have to use the LLVM way (of which this
assert is just a small part): using the non-llvm
version just below would instantly reintroduce
the original gcc bug.  This bug is not serious
for gcc, but it is fatal for LLVM: it results
in callers sometimes thinking that the callee
takes a static chain, while in fact the callee
does not.  Since in gcc the static chain is
passed out-of-band in a special register, it
doesn't matter if the chain is passed even
though it is not needed: the register value
is just ignored.  In LLVM the static chain
becomes an explicit extra parameter: the bug
meant that the caller would pass one more
parameter than the callee was expecting, which
results in all parameters getting wrong values
in the callee - very nasty.  This should really
be fixed in gcc too, since it can result in the
caller itself getting a static chain because it
thinks it needs it to pass to the callee.  That
can result in all kinds of serious inefficiences.


Modified:
    llvm-gcc-4.2/trunk/gcc/tree-nested.c

Modified: llvm-gcc-4.2/trunk/gcc/tree-nested.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-nested.c?rev=63306&r1=63305&r2=63306&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-nested.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-nested.c Thu Jan 29 07:25:08 2009
@@ -1972,7 +1972,6 @@
       walk_function (convert_call_expr, root);
 
       /* LLVM LOCAL begin */
-      /* FIXME: Keep the LLVM-way? */
 #ifdef ENABLE_LLVM
       gcc_assert (!root->outer ||
                   DECL_NO_STATIC_CHAIN (root->context) ==





More information about the llvm-commits mailing list