[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2014-04-16 Thread bernd.edlinger at hotmail dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107

Bernd Edlinger  changed:

   What|Removed |Added

 CC||bernd.edlinger at hotmail dot 
de

--- Comment #38 from Bernd Edlinger  ---
Hmm...

the whole thing goes kaboom if I try to call any of the procedures in
recursive_interface_2.f90.

i.e. if I add the following at the end of the test case:

use m
  procedure(foo), pointer :: p_foo
  procedure(bar), pointer :: p_bar
  procedure(baz), pointer :: p_baz
  p_foo => foo
  p_bar => bar
  p_baz => baz
  call foo (p_foo)
  call baz (p_bar)
  call bar (p_baz)
  call p_foo (p_foo)
  call p_baz (p_bar)
  call p_bar (p_baz)
end


gfortran recursive_interface_2.f90 
gfortran: internal compiler error: Segmentation fault (program f951)
0x40c914 execute
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:2848
0x40ccc4 do_spec_1
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:4652
0x40f586 process_brace_body
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5935
0x40f586 handle_braces
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5849
0x40db39 do_spec_1
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5306
0x40f586 process_brace_body
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5935
0x40f586 handle_braces
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5849
0x40db39 do_spec_1
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5306
0x40d8a3 do_spec_1
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5421
0x40f586 process_brace_body
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5935
0x40f586 handle_braces
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5849
0x40db39 do_spec_1
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5306
0x40f586 process_brace_body
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5935
0x40f586 handle_braces
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5849
0x40db39 do_spec_1
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:5306
0x40e656 do_spec_2
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:4353
0x40fc68 do_spec(char const*)
../../gcc-4.9.0-RC-20140411/gcc/gcc.c:4320
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-02-08 Thread dominiq at lps dot ens.fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #37 from Dominique d'Humieres  
2013-02-08 15:46:48 UTC ---

> This is now done.



Thanks.


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-02-08 Thread mikael at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



Mikael Morin  changed:



   What|Removed |Added



 Status|ASSIGNED|RESOLVED

 Resolution||FIXED



--- Comment #36 from Mikael Morin  2013-02-08 
15:42:53 UTC ---

(In reply to comment #34)

> (In reply to comment #33)

> > Anything missing before this PR can be closed?

> 

> Unburying the patch for comment #4, testing it, committing it.

> :-)



This is now done.


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-02-08 Thread mikael at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #35 from Mikael Morin  2013-02-08 
15:13:45 UTC ---

Author: mikael

Date: Fri Feb  8 15:13:32 2013

New Revision: 195890



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195890

Log:

fortran/

PR fortran/54107

* trans-types.c (gfc_get_function_type): Change a NULL backend_decl

to error_mark_node on entry.  Detect recursive types.  Build a variadic

procedure type if the type is recursive.  Restore the initial

backend_decl.



testsuite/

PR fortran/54107

* gfortran.dg/recursive_interface_2.f90: New test.





Added:

trunk/gcc/testsuite/gfortran.dg/recursive_interface_2.f90

Modified:

trunk/gcc/fortran/ChangeLog

trunk/gcc/fortran/trans-types.c

trunk/gcc/testsuite/ChangeLog


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-02-05 Thread mikael at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #34 from Mikael Morin  2013-02-05 
21:31:20 UTC ---

(In reply to comment #33)

> Anything missing before this PR can be closed?



Unburying the patch for comment #4, testing it, committing it.

:-)


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-02-05 Thread dominiq at lps dot ens.fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #33 from Dominique d'Humieres  
2013-02-05 20:24:37 UTC ---

Anything missing before this PR can be closed?


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-02-04 Thread mikael at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #32 from Mikael Morin  2013-02-04 
18:34:41 UTC ---

Author: mikael

Date: Mon Feb  4 18:34:30 2013

New Revision: 195729



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195729

Log:

fortran/

PR fortran/54107

PR fortran/54195

* gfortran.h (struct gfc_symbol): New field 'resolved'.

* resolve.c (resolve_fl_var_and_proc): Don't skip result symbols.

(resolve_symbol): Skip duplicate calls.  Don't check the current

namespace.



testsuite/

PR fortran/54107

* gfortran.dg/recursive_interface_1.f90: New test.





Added:

trunk/gcc/testsuite/gfortran.dg/recursive_interface_1.f90

Modified:

trunk/gcc/fortran/ChangeLog

trunk/gcc/fortran/gfortran.h

trunk/gcc/fortran/resolve.c

trunk/gcc/testsuite/ChangeLog


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-30 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #31 from janus at gcc dot gnu.org 2013-01-30 15:02:46 UTC ---

(In reply to comment #30)

> > ToDo: The test case in comment 4 still fails (cf. also comment 23 - 27).

> 

> Note that after revision 195562, the test in comment #4 and its subsequent

> modifications are no longer "memory hogs" and now give the ICE in a fraction 
> of

> second.



Right.





> Question: does the patch in comment #23 apply on top of r195562?



Yes, it should.


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-30 Thread dominiq at lps dot ens.fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #30 from Dominique d'Humieres  
2013-01-30 13:34:31 UTC ---

> ToDo: The test case in comment 4 still fails (cf. also comment 23 - 27).



Note that after revision 195562, the test in comment #4 and its subsequent

modifications are no longer "memory hogs" and now give the ICE in a fraction of

second.



r195562 is also likely to have changed the compiler behavior of some of my

tests derived from pr55959 (see pr55959 comment #4).



Question: does the patch in comment #23 apply on top of r195562?


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-29 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #29 from janus at gcc dot gnu.org 2013-01-29 21:45:56 UTC ---

r195562 fixes comment 0.



ToDo: The test case in comment 4 still fails (cf. also comment 23 - 27).


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-29 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #28 from janus at gcc dot gnu.org 2013-01-29 21:40:55 UTC ---

Author: janus

Date: Tue Jan 29 21:40:51 2013

New Revision: 195562



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195562

Log:

2013-01-29  Janus Weil  

Mikael Morin 



PR fortran/54107

* gfortran.h (gfc_component): Delete members 'formal' and 'formal_ns'.

(gfc_copy_formal_args,gfc_copy_formal_args_ppc,gfc_expr_replace_symbols,

gfc_expr_replace_comp): Delete.

(gfc_sym_get_dummy_args): New prototype.

* dependency.c (gfc_check_fncall_dependency): Use

'gfc_sym_get_dummy_args'.

* expr.c (gfc_is_constant_expr): Ditto.

(replace_symbol,gfc_expr_replace_symbols,replace_comp,

gfc_expr_replace_comp): Deleted.

* frontend-passes.c (doloop_code,do_function): Use

'gfc_sym_get_dummy_args'.

* interface.c (gfc_check_operator_interface,gfc_compare_interfaces,

gfc_procedure_use,gfc_ppc_use,gfc_arglist_matches_symbol,

gfc_check_typebound_override): Ditto.

* module.c (MOD_VERSION): Bump module version.

(mio_component): Do not read/write 'formal' and 'formal_ns'.

* resolve.c (resolve_procedure_interface,resolve_fl_derived0): Do not

copy formal args, but just keep a pointer to the interface.

(resolve_function,resolve_call,resolve_typebound_generic_call,

resolve_ppc_call,resolve_expr_ppc,generate_component_assignments,

resolve_fl_procedure,gfc_resolve_finalizers,check_generic_tbp_ambiguity,

resolve_typebound_procedure,check_uop_procedure): Use

'gfc_sym_get_dummy_args'.

* symbol.c (free_components): Do not free 'formal' and 'formal_ns'.

(gfc_copy_formal_args,gfc_copy_formal_args_ppc): Deleted.

(gfc_sym_get_dummy_args): New function.

* trans-array.c (get_array_charlen,gfc_walk_elemental_function_args):

Use 'gfc_sym_get_dummy_args'.

* trans-decl.c (build_function_decl,create_function_arglist,

build_entry_thunks,init_intent_out_dt,gfc_trans_deferred_vars,

add_argument_checking): Ditto.

* trans-expr.c (gfc_map_fcn_formal_to_actual,gfc_conv_procedure_call,

gfc_conv_statement_function): Ditto.

* trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.

* trans-types.c (create_fn_spec,gfc_get_function_type): Ditto.





2013-01-29  Janus Weil  

Mikael Morin 



PR fortran/54107

* gfortran.dg/proc_ptr_comp_36.f90: New.



Added:

trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_36.f90

Modified:

trunk/gcc/fortran/ChangeLog

trunk/gcc/fortran/dependency.c

trunk/gcc/fortran/expr.c

trunk/gcc/fortran/frontend-passes.c

trunk/gcc/fortran/gfortran.h

trunk/gcc/fortran/interface.c

trunk/gcc/fortran/module.c

trunk/gcc/fortran/resolve.c

trunk/gcc/fortran/symbol.c

trunk/gcc/fortran/trans-array.c

trunk/gcc/fortran/trans-decl.c

trunk/gcc/fortran/trans-expr.c

trunk/gcc/fortran/trans-stmt.c

trunk/gcc/fortran/trans-types.c

trunk/gcc/testsuite/ChangeLog


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-28 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #27 from janus at gcc dot gnu.org 2013-01-28 22:42:48 UTC ---

(In reply to comment #26)

> There is one case that remains to be handled.  I suppose it is valid if the

> other are valid.

> 

>   function foo () result(bar)

> procedure(foo), pointer :: bar 

>   end function



Yes, in principle proc-ptr valued functions are allowed. I don't see why it

wouldn't be valid.



This ICEs for me with 4.6, 4.7 and trunk (with the current patches for this

PR).


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-28 Thread mikael at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #26 from Mikael Morin  2013-01-28 
19:46:01 UTC ---

Thanks for testing.

There is one case that remains to be handled.  I suppose it is valid if the

other are valid.



  function foo () result(bar)

procedure(foo), pointer :: bar 

  end function


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-28 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #25 from janus at gcc dot gnu.org 2013-01-28 16:04:14 UTC ---

(In reply to comment #24)

> > Draft patch for comment #4, to be tested.

> 

> Thanks! Seems to work on comment 4 at least. I'll try a regtest.



Regtest went through cleanly, and it also works well for an 'indirect' case

like this:





contains



  subroutine s1 (arg1)

procedure(s2) :: arg1

  end subroutine



  subroutine s2 (arg2)

procedure(s1) :: arg2

  end subroutine



end


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-28 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #24 from janus at gcc dot gnu.org 2013-01-28 13:48:54 UTC ---

(In reply to comment #23)

> Created attachment 29294 [details]

> Draft patch for comment #4, to be tested.



Thanks! Seems to work on comment 4 at least. I'll try a regtest.


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-28 Thread mikael at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



--- Comment #23 from Mikael Morin  2013-01-28 
12:31:19 UTC ---

Created attachment 29294

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29294

Draft patch for comment #4, to be tested.



As I said on @fortran, I don't think it's possible to create recursive

middle-end types.  With this patch the dummy procedure gets a variadic function

type, which is the best we can do in this case.


[Bug fortran/54107] [4.8 Regression] [F03] Memory hog with abstract interface

2013-01-27 Thread janus at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54107



janus at gcc dot gnu.org changed:



   What|Removed |Added



 Status|NEW |ASSIGNED

 AssignedTo|unassigned at gcc dot   |janus at gcc dot gnu.org

   |gnu.org |

Summary|[4.8 Regression] Memory hog |[4.8 Regression] [F03]

   |with abstract interface |Memory hog with abstract

   ||interface