re PR middle-end/26557 (ICE in simplify_subreg)
authorRoger Sayle <sayle@gcc.gnu.org>
Mon, 13 Mar 2006 23:47:47 +0000 (23:47 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 13 Mar 2006 23:47:47 +0000 (23:47 +0000)
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.

From-SVN: r112032

gcc/ChangeLog
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/switch-1.c [new file with mode: 0644]

index 94aac10fd998aa709917ab7e1aca9879037af6aa..8d28b2f835c9c4ad9b1484c8e45ac26d9b8cfcac 100644 (file)
@@ -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
index d199398e55f65c7bc86b271c28cd43bade1cdb22..a3e3db3b3b6b084bd17e36aa90a07f0cb83828ed 100644 (file)
@@ -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))
index f049f464d1bfd69169fffa774cec06a54b57b985..b91ceeaadf3a967aa67482c6bc1225fe71bd552b 100644 (file)
@@ -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 (file)
index 0000000..cc71d30
--- /dev/null
@@ -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();
+  }
+}
+