diff mbox

Fix memory leak in tree-inliner

Message ID CAFiYyc0VMRfJqLV0id2UphTGsMxqDhqcbJK1dHG78TYAb1bnDg@mail.gmail.com
State New
Headers show

Commit Message

Richard Biener May 9, 2016, 10:57 a.m. UTC
On Fri, May 6, 2016 at 2:35 PM, Martin Liška <mliska@suse.cz> wrote:
> On 05/06/2016 12:56 PM, Richard Biener wrote:
>> Hmmm.  But this means debug stmt remapping calls
>> remap_dependence_clique which may end up bumping
>> cfun->last_clique and thus may change code generation.
>>
>> So what debug stmts contain MEM_REFs?  If you put an assert
>> processing_debug_stmt == 0 in
>> remap_dependence_clique I'd like to see a testcase that triggers it.
>>
>> Richard.
>
> Ok, I've placed the suggested assert which is triggered for following debug statement:
>
> (gdb) p debug_gimple_stmt(stmt)
> # DEBUG D#21 => a_1(D)->dim[0].ubound
>
> (gdb) p debug_tree(*tp)
>  <mem_ref 0x7ffff66c1b40
>     type <record_type 0x7ffff6a642a0 array1_unknown type_1 BLK
>         size <integer_cst 0x7ffff6a46180 constant 384>
>         unit size <integer_cst 0x7ffff6a23c90 constant 48>
>         align 64 symtab -160828560 alias set -1 canonical type 0x7ffff6a4f000
>         fields <field_decl 0x7ffff6a47980 data type <pointer_type 0x7ffff68a7348>
>             unsigned DI file /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_constructor_1.f90 line 21 col 0
>             size <integer_cst 0x7ffff6886bd0 constant 64>
>             unit size <integer_cst 0x7ffff6886be8 constant 8>
>             align 64 offset_align 128
>             offset <integer_cst 0x7ffff6886c00 constant 0>
>             bit offset <integer_cst 0x7ffff6886c48 constant 0> context <record_type 0x7ffff6a4f498 array_descriptor1> chain <field_decl 0x7ffff6a47a18 offset>>
>         pointer_to_this <pointer_type 0x7ffff6a64540> reference_to_this <reference_type 0x7ffff6a645e8> chain <type_decl 0x7ffff6a511c8 D.3431>>
>
>     arg 0 <ssa_name 0x7ffff66b41f8
>         type <reference_type 0x7ffff6a64690 type <record_type 0x7ffff6a642a0 array1_unknown>
>             public unsigned restrict DI size <integer_cst 0x7ffff6886bd0 64> unit size <integer_cst 0x7ffff6886be8 8>
>             align 64 symtab 0 alias set -1 canonical type 0x7ffff6a53150>
>         var <parm_decl 0x7ffff6696800 a>def_stmt GIMPLE_NOP
>
>         version 1>
>     arg 1 <integer_cst 0x7ffff6a7a438 type <reference_type 0x7ffff6a64690> constant 0>>
>
> for the following test-case:
> gfortran /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_constructor_1.f90 -O3 -g

Ok.  I suggest you instead do sth like


does that resolve the issue?  If so, this is ok for trunk and branches.

Thanks,
Richard.

> Martin
>
>
>
diff mbox

Patch

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c   (revision 236021)
+++ gcc/tree-inline.c   (working copy)
@@ -840,7 +840,7 @@  is_parm (tree decl)
 static unsigned short
 remap_dependence_clique (copy_body_data *id, unsigned short clique)
 {
-  if (clique == 0)
+  if (clique == 0 || processing_debug_stmt)
     return 0;
   if (!id->dependence_map)
     id->dependence_map = new hash_map<dependence_hash, unsigned short>;