summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-13 23:47:47 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-13 23:47:47 +0000
commita4047043178d090966d1e001b8560929d0d59c9b (patch)
treec4689c459a59af36095a53e46897d7983e27ada0 /gcc
parenta8bf5f4aae5cf8ea651fb541018dbe454f7d01e5 (diff)
downloadppe42-gcc-a4047043178d090966d1e001b8560929d0d59c9b.tar.gz
ppe42-gcc-a4047043178d090966d1e001b8560929d0d59c9b.zip
PR middle-end/26557
* stmt.c (emit_case_nodes): Handle the case where the index is a CONST_INT, where the comparison mode is specified by the index type. * gcc.c-torture/compile/switch-1.c: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112032 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/stmt.c4
-rw-r--r--gcc/testsuite/ChangeLog14
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/switch-1.c9
4 files changed, 29 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 94aac10fd99..8d28b2f835c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-13 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/26557
+ * stmt.c (emit_case_nodes): Handle the case where the index is a
+ CONST_INT, where the comparison mode is specified by the index type.
+
2006-03-13 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa/pa32-linux.h (CRT_CALL_STATIC_FUNCTION): Define when CRTSTUFFS_O
diff --git a/gcc/stmt.c b/gcc/stmt.c
index d199398e55f..a3e3db3b3b6 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -2944,6 +2944,10 @@ emit_case_nodes (rtx index, case_node_ptr node, rtx default_label,
enum machine_mode mode = GET_MODE (index);
enum machine_mode imode = TYPE_MODE (index_type);
+ /* Handle indices detected as constant during RTL expansion. */
+ if (mode == VOIDmode)
+ mode = imode;
+
/* See if our parents have already tested everything for us.
If they have, emit an unconditional jump for this node. */
if (node_is_bounded (node, index_type))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f049f464d1b..b91ceeaadf3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,10 +1,16 @@
+2006-03-13 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/26557
+ * gcc.c-torture/compile/switch-1.c: New test case.
+
2006-03-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25378
- * gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90: Expand test to include more
- permuatations of mask and index.
- * testsuite/gfortran.dg/scalar_mask_1.f90: Modify last test to respond to F2003 spec.
- that the position returned for an all false mask && condition is zero.
+ * gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90: Expand
+ test to include more permuatations of mask and index.
+ * testsuite/gfortran.dg/scalar_mask_1.f90: Modify last test to
+ respond to F2003 spec. that the position returned for an all false
+ mask && condition is zero.
2006-03-13 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/testsuite/gcc.c-torture/compile/switch-1.c b/gcc/testsuite/gcc.c-torture/compile/switch-1.c
new file mode 100644
index 00000000000..cc71d30bb3f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/switch-1.c
@@ -0,0 +1,9 @@
+/* PR middle-end/26557. */
+const int struct_test[1] = {1};
+void g();
+void f() {
+ switch(struct_test[0]) {
+ case 1: g();
+ }
+}
+
OpenPOWER on IntegriCloud