First Last Prev Next    No search results available
Details
: llvmgcc asserts when compiling functions renamed with asm's
Bug#: 68
: tools
: llvm-gcc
Status: RESOLVED
Resolution: FIXED
: PC
: Linux
: 1.0
: P2
: normal
: 1.1

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2003-10-29 13:15
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
------- Comment #1 From Chris Lattner 2003-10-29 13:23:48 -------
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


First Last Prev Next    No search results available