Commit b95605fb by Paul Thomas

re PR fortran/24223 (Gfortran crashes in two places)

2005-11-21  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/24223
	* resolve.c (resolve_contained_fntype) Error if an internal
	function is assumed character length.

	PR fortran/24705
	* trans-decl.c (gfc_create_module_variable) Skip ICE in
	when backend decl has been built and the symbol is marked
	as being in an equivalence statement.

2005-11-21  Paul Thomas  <pault@gcc.gnu.org

	PR fortran/24223
	* gfortran.dg/substring_equivalence.f90: New test.

	PR fortran/24705
	* gfortran.dg/auto_internal_assumed.f90: New test.

From-SVN: r107310
parent 078152a2
2005-11-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24223
* resolve.c (resolve_contained_fntype) Error if an internal
function is assumed character length.
PR fortran/24705
* trans-decl.c (gfc_create_module_variable) Skip ICE in
when backend decl has been built and the symbol is marked
as being in an equivalence statement.
2005-11-20 Toon Moene <toon@moene.indiv.nluug.nl>
* invoke.texi: Remove superfluous @item.
......
......@@ -294,6 +294,19 @@ resolve_contained_fntype (gfc_symbol * sym, gfc_namespace * ns)
sym->attr.untyped = 1;
}
}
/*Fortran 95 Draft Standard, page 51, Section 5.1.1.5, on the Character type,
lists the only ways a character length value of * can be used: dummy arguments
of proceedures, named constants, and function results in external functions.
Internal function results are not on that list; ergo, not permitted. */
if (sym->ts.type == BT_CHARACTER)
{
gfc_charlen *cl = sym->ts.cl;
if (!cl || !cl->length)
gfc_error ("Character-valued internal function '%s' at %L must "
"not be assumed length", sym->name, &sym->declared_at);
}
}
......
......@@ -2366,7 +2366,8 @@ gfc_create_module_variable (gfc_symbol * sym)
return;
/* Equivalenced variables arrive here after creation. */
if (sym->backend_decl && sym->equiv_built)
if (sym->backend_decl
&& (sym->equiv_built || sym->attr.in_equivalence))
return;
if (sym->backend_decl)
......
2005-11-21 Paul Thomas <pault@gcc.gnu.org
PR fortran/24223
* gfortran.dg/substring_equivalence.f90: New test.
PR fortran/24705
* gfortran.dg/auto_internal_assumed.f90: New test.
2005-11-21 Uros Bizjak <uros@kss-loka.si>
* gcc.dg/fold-div-2.c: New test.
! { dg-do compile }
! Test fix of PR24705 - ICE on assumed character length
! internal function.
!
character (6) :: c
c = f1 () ! { dg-error "must not be assumed length" }
if (c .ne. 'abcdef') call abort
contains
function f1 ()
character (*) :: f1
f1 = 'abcdef'
end function f1
end
\ No newline at end of file
! { dg-do compile }
! Tests fix for PR24223 - ICE on equivalence staement.
!
module FLAGS
character(len=5) :: Encodings
character :: at, dev
equivalence ( encodings(1:1),at ), ( encodings(2:2),dev)
end module FLAGS
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