aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-07-15 09:52:51 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-07-15 09:52:51 +0200
commit79c743005119639f4d30b82a708613a072e26681 (patch)
treeced7209a704077c4ef91e239bb92fdbc4850a087 /gcc/fortran
parent23b1042021c8e95a5faa7c58c6ef1665d48afed7 (diff)
downloadgcc-79c743005119639f4d30b82a708613a072e26681.zip
gcc-79c743005119639f4d30b82a708613a072e26681.tar.gz
gcc-79c743005119639f4d30b82a708613a072e26681.tar.bz2
re PR fortran/40206 ([gfortran] Incorrect warning with -Wuninitialized)
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. * gfortran.dg/select_char_3.f90: New test. From-SVN: r162209
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog4
-rw-r--r--gcc/fortran/trans-stmt.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ea1a501..8d89661 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -11,6 +11,10 @@
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
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 8bd0f91..cc3dd72 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -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);
}