OSDN Git Service

PR fortran/40206
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Jul 2010 07:52:51 +0000 (07:52 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 15 Jul 2010 07:52:51 +0000 (07:52 +0000)
* trans-stmt.c (gfc_trans_character_select): Always use NULL for high
in CASE_LABEL_EXPR and use NULL for low for the default case.

* gfortran.dg/select_char_3.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162209 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/select_char_3.f90 [new file with mode: 0644]

index ea1a501..8d89661 100644 (file)
        or NE_EXPR and one of the strings is string literal with LEN_TRIM
        bigger than the length of the other string, they compare unequal.
 
+       PR fortran/40206
+       * trans-stmt.c (gfc_trans_character_select): Always use NULL for high
+       in CASE_LABEL_EXPR and use NULL for low for the default case.
+
 2010-07-14  Mikael Morin  <mikael@gcc.gnu.org>
 
        * trans-array.c (gfc_conv_section_upper_bound): Remove
index 8bd0f91..cc3dd72 100644 (file)
@@ -1681,8 +1681,9 @@ gfc_trans_character_select (gfc_code *code)
         {
          label = gfc_build_label_decl (NULL_TREE);
          tmp = fold_build3 (CASE_LABEL_EXPR, void_type_node,
-                            build_int_cst (NULL_TREE, d->n),
-                            build_int_cst (NULL_TREE, d->n), label);
+                            (d->low == NULL && d->high == NULL)
+                            ? NULL : build_int_cst (NULL_TREE, d->n),
+                            NULL, label);
           gfc_add_expr_to_block (&body, tmp);
         }
 
index 3e04816..bb7b4b0 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/40206
+       * gfortran.dg/select_char_3.f90: New test.
+
 2010-07-15  Magnus Granberg  <zorry@gentoo.org>
            Kevin F. Quinn  <kevquinn@gentoo.org>
 
diff --git a/gcc/testsuite/gfortran.dg/select_char_3.f90 b/gcc/testsuite/gfortran.dg/select_char_3.f90
new file mode 100644 (file)
index 0000000..f0a7c87
--- /dev/null
@@ -0,0 +1,15 @@
+! PR fortran/40206
+! { dg-do compile }
+! { dg-options "-O2 -Wuninitialized" }
+
+function char2type (char)
+  character, intent(in) :: char
+  integer :: char2type
+
+  select case (char)
+    case ('E','e')
+      char2type=1
+    case default
+      char2type=-1234
+  end select
+end function