aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2006-09-20 16:41:12 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2006-09-20 16:41:12 +0000
commit4e60515f9a6cb7a6c2fd59a9e3a1601a929deb92 (patch)
tree6e044ba861af2f20d86a11086e84eb3657abdfd5 /gcc
parentd7f245b19d871058abf50fc7c1cd734720f347a7 (diff)
downloadgcc-4e60515f9a6cb7a6c2fd59a9e3a1601a929deb92.zip
gcc-4e60515f9a6cb7a6c2fd59a9e3a1601a929deb92.tar.gz
gcc-4e60515f9a6cb7a6c2fd59a9e3a1601a929deb92.tar.bz2
re PR target/28574 (switch statement points to unreferenced label at -O2)
PR target/28574 * ifcvt.c (dead_or_predicable): Don't predicate then blocks with tablejumps in them. From-SVN: r117084
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ifcvt.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr28574.c74
3 files changed, 87 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8b8fe3d..640c4b9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-20 Steve Ellcey <sje@cup.hp.com>
+
+ PR target/28574
+ * ifcvt.c (dead_or_predicable): Don't predicate then blocks
+ with tablejumps in them.
+
2006-09-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/28046
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 987a2fb..41da0b3 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -3560,6 +3560,13 @@ dead_or_predicable (basic_block test_bb, basic_block merge_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))
diff --git a/gcc/testsuite/gcc.dg/pr28574.c b/gcc/testsuite/gcc.dg/pr28574.c
new file mode 100644
index 0000000..f5ff6c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr28574.c
@@ -0,0 +1,74 @@
+/* On IA64 This test resulted in a missing jumptable and an undefined
+ reference to a label. Make sure we can compile and link it with
+ no undefs at -O2. */
+
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+typedef enum yasm_module_type {
+ YASM_MODULE_ARCH = 0,
+ YASM_MODULE_DBGFMT,
+ YASM_MODULE_OBJFMT,
+ YASM_MODULE_LISTFMT,
+ YASM_MODULE_OPTIMIZER
+} yasm_module_type;
+
+struct yasm_module {
+ const char *name;
+};
+
+typedef struct yasm_module yasm_arch_module;
+typedef struct yasm_module yasm_dbgfmt_module;
+typedef struct yasm_module yasm_objfmt_module;
+typedef struct yasm_module yasm_listfmt_module;
+typedef struct yasm_module yasm_optimizer_module;
+
+typedef struct module {
+ void *data;
+} module;
+
+static struct {
+ module *m;
+ int n;
+} module_types[] = {
+ {},
+};
+
+void
+yasm_list_modules(yasm_module_type type,
+ void (*printfunc) (const char *name))
+{
+ int i;
+ module *modules = module_types[type].m;
+ yasm_arch_module *arch;
+ yasm_dbgfmt_module *dbgfmt;
+ yasm_objfmt_module *objfmt;
+ yasm_listfmt_module *listfmt;
+ yasm_optimizer_module *optimizer;
+
+ for (i=0; i<2; i++) {
+ switch (type) {
+ case YASM_MODULE_ARCH:
+ arch = modules[i].data;
+ printfunc(arch->name);
+ break;
+ case YASM_MODULE_DBGFMT:
+ dbgfmt = modules[i].data;
+ printfunc(dbgfmt->name);
+ break;
+ case YASM_MODULE_OBJFMT:
+ objfmt = modules[i].data;
+ printfunc(objfmt->name);
+ break;
+ case YASM_MODULE_LISTFMT:
+ listfmt = modules[i].data;
+ printfunc(listfmt->name);
+ break;
+ case YASM_MODULE_OPTIMIZER:
+ optimizer = modules[i].data;
+ printfunc(optimizer->name);
+ }
+ }
+}
+
+main() {}