[fortran] PR69498 Fixing ICE with double free on symbol

Submitted by Nicolas Koenig on March 19, 2017, 10:41 p.m.

Details

Message ID 0f5846a1-146e-2ebf-e6bf-7cc6d362eb33@student.ethz.ch
State New
Headers show

Commit Message

Nicolas Koenig March 19, 2017, 10:41 p.m.
Hello everyone,

a one-line-fix for one of the test cases in pr69498. The refs count of 
the ppr@ symbol wasn't set properly. Attached are the patch & the test case.

If I understand the 'Write Access' page correctly, this would be the 
kind of patch I would not have to bother the mailing list with but 
instead could commit directly? Would this count as an "obvious fix"?

Nicolas

Regression tested for x86_64-pc-linux-gnu.

2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch>

                 PR fortran/69498
                 * decl.c (add_hidden_procptr_result): Fixed Refs count 
of the created "ppr@" symbol.

2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch>

                 PR fortran/69498
                 * gfortran.dg/unexp_attribute.f90: New test

Comments

Paul Richard Thomas March 20, 2017, 5:36 p.m.
Dear Nicolas,

This is indeed an obvious fix and it's OK for trunk

However, we would prefer it that you submit even blindingly obvious
patches for a while. You can generally get rapid approval for such
patches by joining us on #gfortran.

Thanks for the patch.

Paul

PS Are you going to have a stab at the other failing cases in the PR?

On 19 March 2017 at 22:41, Nicolas Koenig <koenigni@student.ethz.ch> wrote:
> Hello everyone,
>
> a one-line-fix for one of the test cases in pr69498. The refs count of the
> ppr@ symbol wasn't set properly. Attached are the patch & the test case.
>
> If I understand the 'Write Access' page correctly, this would be the kind of
> patch I would not have to bother the mailing list with but instead could
> commit directly? Would this count as an "obvious fix"?
>
> Nicolas
>
> Regression tested for x86_64-pc-linux-gnu.
>
> 2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch>
>
>                 PR fortran/69498
>                 * decl.c (add_hidden_procptr_result): Fixed Refs count of
> the created "ppr@" symbol.
>
> 2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch>
>
>                 PR fortran/69498
>                 * gfortran.dg/unexp_attribute.f90: New test
>
>

Patch hide | download patch | download mbox

Index: decl.c
===================================================================
--- decl.c	(revision 246260)
+++ decl.c	(working copy)
@@ -5430,6 +5430,7 @@  add_hidden_procptr_result (gfc_symbol *sym)
 	  gfc_get_sym_tree ("ppr@", gfc_current_ns->parent, &stree, false);
 	  st2 = gfc_new_symtree (&gfc_current_ns->sym_root, "ppr@");
 	  st2->n.sym = stree->n.sym;
+	  stree->n.sym->refs++;
 	}
       sym->result = stree->n.sym;