[Bug fortran/52426] ICE for c_loc with array constructor

2013-03-25 Thread burnus at gcc dot gnu.org


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



Tobias Burnus  changed:



   What|Removed |Added



 Status|NEW |RESOLVED

 Resolution||FIXED



--- Comment #3 from Tobias Burnus  2013-03-25 
17:52:11 UTC ---

FIXED on the 4.9 trunk.


[Bug fortran/52426] ICE for c_loc with array constructor

2013-03-25 Thread burnus at gcc dot gnu.org


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



Tobias Burnus  changed:



   What|Removed |Added



 CC||burnus at gcc dot gnu.org



--- Comment #2 from Tobias Burnus  2013-03-25 
15:54:22 UTC ---

Author: burnus

Date: Mon Mar 25 15:40:26 2013

New Revision: 197053



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

Log:

2013-03-25  Tobias Burnus  



PR fortran/38536

PR fortran/38813

PR fortran/38894

PR fortran/39288

PR fortran/40963

PR fortran/45824

PR fortran/47023

PR fortran/47034

PR fortran/49023

PR fortran/50269

PR fortran/50612

PR fortran/52426

PR fortran/54263

PR fortran/55343

PR fortran/55444

PR fortran/55574

PR fortran/56079

PR fortran/56378

* check.c (gfc_var_strlen): Properly handle 0-sized string.

(gfc_check_c_sizeof): Use is_c_interoperable, add checks.

(is_c_interoperable, gfc_check_c_associated, gfc_check_c_f_pointer,

gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc): New

functions.

* expr.c (check_inquiry): Add c_sizeof, compiler_version and

compiler_options.

(gfc_check_pointer_assign): Refine function result check.

gfortran.h (gfc_isym_id): Add GFC_ISYM_C_ASSOCIATED,

GFC_ISYM_C_F_POINTER, GFC_ISYM_C_F_PROCPOINTER, GFC_ISYM_C_FUNLOC,

GFC_ISYM_C_LOC.

(iso_fortran_env_symbol, iso_c_binding_symbol): Handle

NAMED_SUBROUTINE.

(generate_isocbinding_symbol): Update prototype.

(get_iso_c_sym): Remove.

(gfc_isym_id_by_intmod, gfc_isym_id_by_intmod_sym): New prototypes.

* intrinsic.c (gfc_intrinsic_subroutine_by_id): New function.

(gfc_intrinsic_sub_interface): Use it.

(add_functions, add_subroutines): Add missing C-binding intrinsics.

(gfc_intrinsic_func_interface): Add special case for c_loc.

gfc_isym_id_by_intmod, gfc_isym_id_by_intmod_sym): New functions.

(gfc_intrinsic_func_interface, gfc_intrinsic_sub_interface): Use them.

* intrinsic.h (gfc_check_c_associated, gfc_check_c_f_pointer,

gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc,

gfc_resolve_c_loc, gfc_resolve_c_funloc): New prototypes.

* iresolve.c (gfc_resolve_c_loc, gfc_resolve_c_funloc): New

functions.

* iso-c-binding.def: Split PROCEDURE into NAMED_SUBROUTINE and

NAMED_FUNCTION.

* iso-fortran-env.def: Add NAMED_SUBROUTINE for completeness.

* module.c (create_intrinsic_function): Support subroutines and

derived-type results.

(use_iso_fortran_env_module): Update calls.

(import_iso_c_binding_module): Ditto; update calls to

generate_isocbinding_symbol.

* resolve.c (find_arglists): Skip for intrinsic symbols.

(gfc_resolve_intrinsic): Find intrinsic subs via id.

(is_scalar_expr_ptr, gfc_iso_c_func_interface,

set_name_and_label, gfc_iso_c_sub_interface): Remove.

(resolve_function, resolve_specific_s0): Remove calls to those.

(resolve_structure_cons): Fix handling.

* symbol.c (gen_special_c_interop_ptr): Update c_ptr/c_funptr

generation.

(gen_cptr_param, gen_fptr_param, gen_shape_param,

build_formal_args, get_iso_c_sym): Remove.

(std_for_isocbinding_symbol): Handle NAMED_SUBROUTINE.

(generate_isocbinding_symbol): Support hidden symbols and

using c_ptr/c_funptr symtrees for nullptr defs.

* target-memory.c (gfc_target_encode_expr): Fix handling

of c_ptr/c_funptr.

* trans-expr.c (conv_isocbinding_procedure): Remove.

(gfc_conv_procedure_call): Remove call to it.

(gfc_trans_subcomponent_assign, gfc_conv_expr): Update handling

of c_ptr/c_funptr.

* trans-intrinsic.c (conv_isocbinding_function,

conv_isocbinding_subroutine): New.

(gfc_conv_intrinsic_function, gfc_conv_intrinsic_subroutine):

Call them.

* trans-io.c (transfer_expr): Fix handling of c_ptr/c_funptr.

* trans-types.c (gfc_typenode_for_spec,

gfc_get_derived_type): Ditto.

(gfc_init_c_interop_kinds): Handle NAMED_SUBROUTINE.



2013-03-25  Tobias Burnus  



PR fortran/38536

PR fortran/38813

PR fortran/38894

PR fortran/39288

PR fortran/40963

PR fortran/45824

PR fortran/47023

PR fortran/47034

PR fortran/49023

PR fortran/50269

PR fortran/50612

PR fortran/52426

PR fortran/54263

PR fortran/55343

PR fortran/55444

PR fortran/55574

PR fortran/5607

[Bug fortran/52426] ICE for c_loc with array constructor

2012-02-29 Thread fxcoudert at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52426

Francois-Xavier Coudert  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-02-29
 CC||fxcoudert at gcc dot
   ||gnu.org
 Ever Confirmed|0   |1


[Bug fortran/52426] ICE for c_loc with array constructor

2012-02-28 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52426

Tobias Burnus  changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus  2012-02-28 
23:13:40 UTC ---
(In reply to comment #0)
> Reported at comp.lang.fortran at 

at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/4bc3966b9ca9dbae
by glen herrmannsfeldt


From Fortran 2008 regarding C_LOC:

"Argument. X shall have either the POINTER or TARGET attribute. It shall not be
a coindexed object. It shall either be a variable with interoperable type and
kind type parameters, or be a scalar, nonpolymorphic variable with no length
type parameters. If it is allocatable, it shall be allocated. If it is a
pointer, it shall be associated. If it is an array, it shall be contiguous and
have nonzero size. It shall not be a zero-length string."

TS 29113 just deleted:
{In 15.2.3.6 C LOC(X), paragraph 3}
Delete “scalar,”.