Bugzilla – Bug 397
[llvm-gcc] Inline function redefinitions error due to 'asm' function rename
Last modified: 2004-11-27 17:26:38
You need to log in before you can comment on or make changes to this bug.
This happens on linux/i386: cc1plus: ../../gcc/llvm-representation.c:237: llvm_value_print_operand: Assertion `!Fn->ForwardedFunction->ForwardedFunction&&"Cannot double forward!"' failed. llvm_bug.cpp:3789: internal compiler error: Aborted Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://llvm.cs.uiuc.edu> for instructions.
Created an attachment (id=148) [details] Preprocessed source that triggers the error.
Created an attachment (id=149) [details] Reduced testcase Here's a mostly reduced testcase
btw, I'm not going to be able to get to this tonight. Probably in the next few days it will be fixed. Sorry abt that!
Hello, I currently encounter the same problem as Markus. It too seems to stem from the inclusion of file I/O related files. I would greatly appreciate seeing this problem resolved. If you need my test case too, please let me know. Thank you very much.
Might I ask somebody to look at this bug once again? It is currently a showstopper for using C++ on linux/i386 for lots of programs, as the ICE is triggered by just including <sys/stat.h>. Thanks.
I looked at this problem. It is easily reproducible using the reduced testcase. I believe the problem is the use of __asm__(...) in the declarations of the various "stat" functions. At least, when I delete them, it compiles fine. Since llvm-gcc doesn't support inline assembly, the necessary fix is to hack the stat.h header file. The original bug report says this comes from linux/i386. Looking at /usr/include/sys/stat.h on my machine, one potential workaround is to undefine __REDIRECT before include sys/stat.h This is the macro that uses the asm statement to redirect to another function name. If it is not defined then the redirect is done by the pre-processor with a #define. Worth a try anyway.
Please note that the use of __asm__ in this context does not refer to (inline) assembly, but rather it defines the external (linkage) name of a function/symbol.
Just as an update, the reduced test case still triggers the assertion using today's CVS HEAD llvm-g++.
Yes. The changes I made to llvm-expand.c are unrelated and just remove some compilation warnings that bothered me. I'm not really sure how to fix this double indirection thing (function defined as asm defined as asm) except using the workaround I previous posted (undefine __REDIRECT macro)
Hi all, I'm currently out of town, but I will try to get this one when I get back. Unfortunately, I don't know if this bug is ours, or if it is in the gcc bits that we imported. I will find out for sure though when I can. -Chris btw, unassignedbugs goes to me, so there is no need to have me on the cc list. Thanks!
Created an attachment (id=180) [details] More reduced testcase. I've further reduced the testcase and did more testing: - it works if you compile it as C source - it works in C++ if you remove the extern "C" - it works in C++ if you #define __inline__ to nothing Also, if you start changing the lstat parameters to someting like int lstat(int) the ICE goes aways and you get a "warning: LLVM: LinkOnce function redefined to external!". Markus
Created an attachment (id=181) [details] Testcase with warning instead of ICE. For completness, here is the modified testcase that generates "warning: LLVM: LinkOnce function redefined to external!".
Fixed. Testcase here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041122/021380.html Patch here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041122/021381.html -Chris