diff mbox

[fortran] PR64921 class_allocate_18 failure

Message ID 55B91045.7010408@sfr.fr
State New
Headers show

Commit Message

Mikael Morin July 29, 2015, 5:41 p.m. UTC
Hello,

I submit the PR64921 fix I posted two days ago on bugzilla.
The problem comes from the finalization wrapper not having the 
always_explicit attribute set, so that when it is called, the array 
argument is passed without descriptor, but the argument declaration is a 
descriptor array.  Boom!

Normally the always_explicit attribute is set automatically during 
resolution, but the code generated by finalization is not passed through 
resolution.  As resolution also takes care of error reporting,
I prefer to not pass the generated code through resolution.

So the attached patch just sets the flag.
I think it can be backported.

The test is already present on the trunk and 5 branch. I plan to add it 
to 4.9 as well.

Regression tested on x86_64-unkown-linux-gnu. OK for 6/5/4.9 ?

Mikael
2015-07-29  Mikael Morin  <mikael@gcc.gnu.org>

	PR fortran/64921
	* class.c (generate_finalization_wrapper): Set finalization
	procedure symbol's always_explicit attribute.
diff mbox

Patch

diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 218973d..7a9e275 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -1599,6 +1599,7 @@  generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
   final->ts.type = BT_INTEGER;
   final->ts.kind = 4;
   final->attr.artificial = 1;
+  final->attr.always_explicit = 1;
   final->attr.if_source = expr_null_wrapper ? IFSRC_IFBODY : IFSRC_DECL;
   if (ns->proc_name->attr.flavor == FL_MODULE)
     final->module = ns->proc_name->name;