Bugzilla – Bug 68
llvmgcc asserts when compiling functions renamed with asm's
Last modified: 2003-10-29 13:23:48
You need to log in before you can comment on or make changes to this bug.
llvmgcc asserts on this testcase: ---- struct foo { int X; }; struct bar { int Y; }; extern int Func(struct foo*) __asm__("Func64"); extern int Func64(struct bar*); extern __inline__ int Func(struct foo *F) { return 1; } extern __inline__ int Func64(struct bar* B) { return 0; } --- $ llvmgcc -S test.c cc1: ../../gcc-3.4/gcc/llvm-representation.c:776: llvm_function_print: Assertion `isPrototype &&"Cannot forward away from a function implementation!"' failed. test.c:16: internal compiler error: Aborted Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://llvm.cs.uiuc.edu> for instructions. It's hard to believe that this is valid code, but gcc accepts it... -Chris
This is fixed by this patch to the C front-end: $ diff -u llvm-representation.c-old llvm-representation.c --- llvm-representation.c-old 2003-10-29 13:19:17.000000000 -0600 +++ llvm-representation.c 2003-10-29 13:19:23.000000000 -0600 @@ -772,10 +772,8 @@ assert(Ty->ID == FunctionTyID && "Function isn't a function type?"); /* If this function got forwarded away, don't print it! */ - if (Fn->ForwardedFunction) { - assert(isPrototype &&"Cannot forward away from a function implementation!"); + if (Fn->ForwardedFunction) return; - } if (isPrototype) fprintf(F, "declare "); /* Function prototype? */ ------------- Tested as test/Regression/CFrontend/2003-10-29-AsmRename.c