Commit 79c74300 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 23b10420
......@@ -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
......
......@@ -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);
}
......
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>
......
! 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment