[LLVMbugs] [Bug 202] RESOLVED: [llvm-gcc] asserts when an extern inline function is redefined

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 8 09:16:51 PST 2004


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=202

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |182
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|llvm-gcc asserts on Fn-     |[llvm-gcc] asserts when an
                   |>BasicBlocksFirst           |extern inline function is
                   |                            |redefined
            Version|1.1                         |1.0

Bug 202 depends on bug 182, which changed state.

Bug 182 Summary: [llvmgcc] C front-end does not compile "extern inline" into linkonce
http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=182

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From sabre at nondot.org  2004-01-08 11:16 -------
Fixed, testcase here: test/Regression/CFrontend/2004-01-08-ExternInlineRedefine.c

Patch here:
$ diff -u llvm-expand.c~ llvm-expand.c
--- llvm-expand.c~      2004-01-08 10:53:45.000000000 -0600
+++ llvm-expand.c       2004-01-08 11:08:13.000000000 -0600
@@ -6161,6 +6161,17 @@
   /* No more processing for external functions. */
   if (isExternal) return Fn;
 
+  /* If there is already a body for this function, it's a wierd error.  The only
+   * case we allow is if the old function was linkonce.
+  */
+  if (!llvm_ilist_empty(llvm_basicblock, Fn->BasicBlocks)) {
+    assert(Fn->Linkage == L_LinkOnce &&
+           "Cannot redefine non-linkonce functions!");
+    llvm_ilist_clear(llvm_basicblock, Fn->BasicBlocks);
+    llvm_ilist_clear(llvm_argument, Fn->Arguments);
+    Fn->Linkage = L_External;
+  }
+
   if (!TREE_PUBLIC(subr) || lang_hooks.llvm_is_in_anon(subr))
     Fn->Linkage = L_Internal;
   else if (DECL_COMDAT(subr) || 

Also requires this bugfix:
$ diff -u llvm-ilist.h~ llvm-ilist.h
--- llvm-ilist.h~       2003-08-28 00:50:59.000000000 -0500
+++ llvm-ilist.h        2004-01-08 11:14:06.000000000 -0600
@@ -80,6 +80,7 @@
 #define llvm_ilist_clear(TYPE, LIST) do {        \
   llvm_ilist_foreach(TYPE, LIST, TYPE##_delete); \
   LIST##First = LIST##Last;                      \
+  LIST##First->Prev = 0;                         \
 } while (0)
 
 /* llvm_ilist_destruct - Destroy the entire list */


Note that this depends on the bugfix for Bug 182.

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list