[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug target/28574] [4.2 regression] switch statement points to unreferenced label at -O2




------- Comment #9 from sje at cup dot hp dot com  2006-09-14 22:37 -------
I don't see any way to delete a block without deleting the attached jumptable
so the only fix I can see is to not delete the block in the first place.  The
block is being deleted on IA64 because it is a 'then block' on an if statment
and the code is being predicated and moved up to the previous block (where the
if is). After the instructions are moved/copied we don't need the then block
and we delete it, along with the attached jumptable.  I am currently testing a
fix/hack that fixes the problem by not allowing us to do the if conversion. 
This means we wind up with an explicit jump instead of predicated instructions
for this test case.  My proposed patch (still being tested) is:

Index: ifcvt.c
===================================================================
--- ifcvt.c     (revision 116938)
+++ ifcvt.c     (working copy)
@@ -3560,6 +3560,13 @@ dead_or_predicable (basic_block test_bb,
   head = BB_HEAD (merge_bb);
   end = BB_END (merge_bb);

+  /* If merge_bb ends with a tablejump, predicating/moving insn's
+     into test_bb and then deleting merge_bb will result in the jumptable
+     that follows merge_bb being removed along with merge_bb and then we
+     get an unresolved reference to the jumptable.  */
+  if (tablejump_p (end, NULL, NULL))
+    return FALSE;
+
   if (LABEL_P (head))
     head = NEXT_INSN (head);
   if (NOTE_P (head))


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28574

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



Reply to: