From: Tobias Burnus Date: Sat, 26 Jan 2008 20:44:49 +0000 (+0100) Subject: re PR fortran/34848 (internal compiler error with optional argument of character... X-Git-Tag: releases/gcc-4.3.0~375 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c80cb0ef7df9e250a0a7826a4414d0895c65027;p=thirdparty%2Fgcc.git re PR fortran/34848 (internal compiler error with optional argument of character type and array return type) 2008-01-26 Tobias Burnus PR fortran/34848 * trans-expr.c (gfc_conv_function_call): Don't call gfc_add_interface_mapping if the expression is NULL. 2008-01-26 Tobias Burnus PR fortran/34848 * gfortran.dg/missing_optional_dummy_5.f90: New. From-SVN: r131876 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0c8f4a236ca0..9e0c2f0fcec7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-01-26 Tobias Burnus + + PR fortran/34848 + * trans-expr.c (gfc_conv_function_call): Don't call + gfc_add_interface_mapping if the expression is NULL. + 2008-01-26 Jerry DeLisle PR fortran/31610 diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 9e30a9938430..89bc3c28537f 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2506,7 +2506,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, } } - if (fsym && need_interface_mapping) + if (fsym && need_interface_mapping && e) gfc_add_interface_mapping (&mapping, fsym, &parmse, e); gfc_add_block_to_block (&se->pre, &parmse.pre); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6974e2177cfc..65924d2ce81b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-26 Tobias Burnus + + PR fortran/34848 + * gfortran.dg/missing_optional_dummy_5.f90: New. + 2008-01-26 Kaveh R. Ghazi * gcc.dg/tree-ssa/20070302-1.c (baz): Mark with attribute diff --git a/gcc/testsuite/gfortran.dg/missing_optional_dummy_5.f90 b/gcc/testsuite/gfortran.dg/missing_optional_dummy_5.f90 new file mode 100644 index 000000000000..2be90fd004aa --- /dev/null +++ b/gcc/testsuite/gfortran.dg/missing_optional_dummy_5.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! PR fortran/34848 +! +! This was before giving an ICE; additionally +! the "0" for the string size of the absent optional +! argument was missing. +! +module krmod +contains + subroutine doit() + implicit none + real :: doit1(2) + doit1 = tm_doit() + return + end subroutine doit + function tm_doit(genloc) + implicit none + character, optional :: genloc + real :: tm_doit(2) + tm_doit = 42.0 + end function tm_doit +end module krmod + +! { dg-final { scan-tree-dump " tm_doit \\(&parm.7, 0B, 0\\);" "original" } } +! { dg-final { cleanup-tree-dump "original" } } +! { dg-final { cleanup-modules "pr22146" } } +