re PR fortran/35932 (ICE: CHAR with array arg and also a KIND arg)
2008-04-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/35932 * trans-intrinsic.c (gfc_conv_intrinsic_char): Even though KIND is not used, the argument must be converted. 2008-04-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/35932 * gfortran.dg/intrinsic_char_1.f90: New test. From-SVN: r134364
This commit is contained in:
parent
64bfac4146
commit
c240868146
@ -1,3 +1,9 @@
|
||||
2008-04-16 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/35932
|
||||
* trans-intrinsic.c (gfc_conv_intrinsic_char): Even though KIND
|
||||
is not used, the argument must be converted.
|
||||
|
||||
2008-04-16 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/35662
|
||||
|
@ -1266,19 +1266,22 @@ gfc_conv_intrinsic_dprod (gfc_se * se, gfc_expr * expr)
|
||||
static void
|
||||
gfc_conv_intrinsic_char (gfc_se * se, gfc_expr * expr)
|
||||
{
|
||||
tree arg;
|
||||
tree arg[2];
|
||||
tree var;
|
||||
tree type;
|
||||
unsigned int num_args;
|
||||
|
||||
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
|
||||
/* We must allow for the KIND argument, even though.... */
|
||||
num_args = gfc_intrinsic_argument_list_length (expr);
|
||||
gfc_conv_intrinsic_function_args (se, expr, arg, num_args);
|
||||
|
||||
/* We currently don't support character types != 1. */
|
||||
/* .... we currently don't support character types != 1. */
|
||||
gcc_assert (expr->ts.kind == 1);
|
||||
type = gfc_character1_type_node;
|
||||
var = gfc_create_var (type, "char");
|
||||
|
||||
arg = convert (type, arg);
|
||||
gfc_add_modify_expr (&se->pre, var, arg);
|
||||
arg[0] = convert (type, arg[0]);
|
||||
gfc_add_modify_expr (&se->pre, var, arg[0]);
|
||||
se->expr = gfc_build_addr_expr (build_pointer_type (type), var);
|
||||
se->string_length = integer_one_node;
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2008-04-16 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/35932
|
||||
* gfortran.dg/intrinsic_char_1.f90: New test.
|
||||
|
||||
2008-04-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||
|
||||
PR target/35944
|
||||
|
17
gcc/testsuite/gfortran.dg/intrinsic_char_1.f90
Normal file
17
gcc/testsuite/gfortran.dg/intrinsic_char_1.f90
Normal file
@ -0,0 +1,17 @@
|
||||
! { dg-do run }
|
||||
! Tests the fix for PR35932, in which the KIND argument of CHAR
|
||||
! was not converted and this screwed up the scalarizer.
|
||||
!
|
||||
! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
|
||||
!
|
||||
program FA0005
|
||||
|
||||
CHARACTER(1) CDA1(10)
|
||||
character(10) CDA10
|
||||
INTEGER :: IDA(10) = [(i, i = 97,106)]
|
||||
|
||||
CDA1 = CHAR ( IDA, KIND("A" )) !failed
|
||||
if (transfer (CDA1, CDA10) /= "abcdefghij") call abort ()
|
||||
CDA1 = CHAR ( IDA ) !worked
|
||||
if (transfer (CDA1, CDA10) /= "abcdefghij") call abort ()
|
||||
END
|
Loading…
Reference in New Issue
Block a user