[Bug fortran/29115] ICE in structure constructor for array, ponter component with non-pointer data

2006-11-06 Thread pault at gcc dot gnu dot org


--- Comment #6 from pault at gcc dot gnu dot org  2006-11-06 17:18 ---
Subject: Bug 29115

Author: pault
Date: Mon Nov  6 17:18:03 2006
New Revision: 118522

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118522
Log:
2006-11-06  Paul Thomas  <[EMAIL PROTECTED]>


PR fortran/29373
* decl.c (get_proc_name, gfc_match_function_decl): Add
attr.implicit_type to conditions that throw error for
existing explicit interface and that allow new type-
spec to be applied.

PR fortran/29407
* resolve.c (resolve_fl_namelist): Do not check for
namelist/procedure conflict, if the symbol corresponds
to a good local variable declaration.

PR fortran/27701
* decl.c (get_proc_name): Replace the detection of a declared
procedure by the presence of a formal argument list by the
attributes of the symbol and the presence of an explicit
interface.

PR fortran/29232
* resolve.c (resolve_fl_variable): See if the host association
of a derived type is blocked by the presence of another type I
object in the current namespace.

PR fortran/29364
* resolve.c (resolve_fl_derived): Check for the presence of
the derived type for a derived type component.

PR fortran/24398
* module.c (gfc_use_module): Check that the first words in a
module file are 'GFORTRAN module'.

PR fortran/29115
* resolve.c (resolve_structure_cons): It is an error if the
pointer component elements of a derived type constructor are
not pointer or target.

PR fortran/29211
* trans-stmt.c (generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp): Provide a string length for
the temporary by copying that of the other side of the scalar
assignment.

PR fortran/29098
* resolve.c (resolve_structure_cons): Do not return FAILURE if
component expression is NULL.


2006-11-06  Paul Thomas  <[EMAIL PROTECTED]>

PR fortran/29373
* gfortran.dg/implicit_9.f90: New test.

PR fortran/29407
* gfortran.dg/namelist_25.f90: New test.

PR fortran/27701
* gfortran.dg/same_name_2.f90: New test.

PR fortran/29232
* gfortran.dg/host_assoc_types_1.f90: New test.

PR fortran/29364
* gfortran.dg/missing_derived_type_1.f90: New test.
* gfortran.dg/implicit_actual.f90: Comment out USE GLOBAL.

PR fortran/29115
* gfortran.dg/derived_constructor_comps_2.f90: New test.

PR fortran/29211
* gfortran.dg/forall_char_dependencies_1.f90: New test.

PR fortran/29098
* gfortran.dg/default_initialization_2.f90: New test.

Added:
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/default_initialization_2.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/forall_char_dependencies_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/host_assoc_types_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/implicit_9.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/missing_derived_type_1.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/namelist_25.f90
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/same_name_2.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/decl.c
branches/gcc-4_1-branch/gcc/fortran/module.c
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/fortran/trans-stmt.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/implicit_actual.f90


-- 


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



[Bug fortran/29115] ICE in structure constructor for array, ponter component with non-pointer data

2006-10-08 Thread pault at gcc dot gnu dot org


--- Comment #5 from pault at gcc dot gnu dot org  2006-10-08 16:29 ---
Fixed for gcc-4.2

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/29115] ICE in structure constructor for array, ponter component with non-pointer data

2006-10-08 Thread pault at gcc dot gnu dot org


--- Comment #4 from pault at gcc dot gnu dot org  2006-10-08 16:22 ---
Subject: Bug 29115

Author: pault
Date: Sun Oct  8 16:21:55 2006
New Revision: 117558

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117558
Log:
2006-10-05  Erik Edelmann <[EMAIL PROTECTED]>
Paul Thomas <[EMAIL PROTECTED]>

PR fortran/20541
* interface.c (gfc_compare_derived_types): Add comparison of
the allocatable field.
* intrinsic.c (add_subroutines): Add MOVE_ALLOC.
* trans-expr.c (gfc_conv_aliased_arg, gfc_trans_subarray_assign,
gfc_trans_subcomponent_assign, gfc_conv_string_parameter,
gfc_trans_scalar_assign): Add extra arguments l_is_temp
and r_is_var to references to latter function.
(gfc_conv_function_call): Add enum for types of argument and
an associated variable parm_kind. Deallocate components of
INTENT(OUT) and non-variable arrays.
(gfc_trans_subcomponent_assign): Add block to assign arrays
to allocatable components.
(gfc_trans_scalar_assign): Add block to handle assignments of
derived types with allocatable components, using the above new
arguments to control allocation/deallocation of memory and the
copying of allocated arrays.
* trans-array.c (gfc_array_allocate): Remove old identification 
of pointer and replace with that of an allocatable array. Add
nullify of structures with allocatable components. 
(gfc_conv_array_initializer): Treat EXPR_NULL.
(gfc_conv_array_parameter): Deallocate allocatable components
of non-variable structures.
(gfc_trans_dealloc_allocated): Use second argument of library
deallocate to inhibit, without error, freeing NULL pointers.
(get_full_array_size): New function to return the size of a
full array.
(gfc_duplicate_allocatable): New function to allocate and copy
allocated data.
(structure_alloc_comps): New recursive function to deallocate,
nullify or copy allocatable components.
(gfc_nullify_alloc_comp, gfc_deallocate_alloc_comp,
gfc_copy_alloc_comp): New interface functions to call previous.
(gfc_trans_deferred_array): Add the code to nullify allocatable
components, when entering scope, and to deallocate them on
leaving. Do not call gfc_trans_static_array_pointer and return
for structures with allocatable components and default
initializers.
* symbol.c (gfc_set_component_attr): Set allocatable field.
(gfc_get_component_attr): Set the allocatable attribute.
* intrinsic.h : Prototype for gfc_check_move_alloc.
* decl.c (build_struct): Apply TR15581 constraints for
allocatable components.
(variable_decl): Default initializer is always NULL for
allocatable components.
(match_attr_spec): Allow, or not, allocatable components,
according to the standard in force.
* trans-array.h : Prototypes for gfc_nullify_alloc_comp,
gfc_deallocate_alloc_comp, gfc_copy_alloc_comp and
gfc_duplicate_allocatable.
* gfortran.texi : Add mention of TR15581 extensions.
* gfortran.h : Add attribute alloc_comp, add
gfc_components field allocatable and add the prototype
for gfc_expr_to_initialize.
* trans-stmt.c (generate_loop_for_temp_to_lhs,
generate_loop_for_rhs_to_temp, gfc_trans_where_assign,
gfc_trans_where_3): Add extra arguments to calls to
gfc_trans_scalar_assign and set appropriately.
(gfc_trans_allocate): Nullify allocatable components.
(gfc_trans_deallocate): Deallocate to ultimate allocatable
components but stop at ultimate pointer components.
* module.c (mio_symbol_attribute, mio_symbol_attribute,
mio_component): Add module support for allocatable
components.
* trans-types.c (gfc_get_derived_type): Treat allocatable
components.
* trans.h : Add two boolean arguments to
gfc_trans_scalar_assign.
* resolve.c (resolve_structure_cons): Check conformance of
constructor element and the component.
(resolve_allocate_expr): Add expression to nullify the
constructor expression for allocatable components.
(resolve_transfer): Inhibit I/O of derived types with
allocatable components.
(resolve_fl_derived): Skip check of bounds of allocatable
components.
* trans-decl.c (gfc_get_symbol_decl): Add derived types
with allocatable components to deferred variable.
(gfc_trans_deferred_vars): Make calls for derived types
with allocatable components to gfc_trans_deferred_array.
(gfc_generate_function_code): Nullify allocatable
component function result on entry.
* parse.c (parse_derived): Set symbol attr.allocatable if
allocatable components are 

[Bug fortran/29115] ICE in structure constructor for array, ponter component with non-pointer data

2006-09-18 Thread paul dot richard dot thomas at cea dot fr


--- Comment #3 from paul dot richard dot thomas at cea dot fr  2006-09-18 
15:29 ---
This is still better and even regtests!

Index: gcc/fortran/resolve.c
===
*** gcc/fortran/resolve.c   (révision 116697)
--- gcc/fortran/resolve.c   (copie de travail)
*** resolve_structure_cons (gfc_expr * expr)
*** 583,588 
--- 593,599 
gfc_constructor *cons;
gfc_component *comp;
try t;
+   symbol_attribute a;

t = SUCCESS;
cons = expr->value.constructor;
*** resolve_structure_cons (gfc_expr * expr)
*** 597,606 
for (; comp; comp = comp->next, cons = cons->next)
  {
if (! cons->expr)
!   {
! t = FAILURE;
! continue;
!   }

if (gfc_resolve_expr (cons->expr) == FAILURE)
{
--- 608,614 
for (; comp; comp = comp->next, cons = cons->next)
  {
if (! cons->expr)
!   continue;

if (gfc_resolve_expr (cons->expr) == FAILURE)
{
*** resolve_structure_cons (gfc_expr * expr)
*** 622,627 
--- 630,648 
  else
t = gfc_convert_type (cons->expr, &comp->ts, 1);
}
+ 
+   if (!comp->pointer || cons->expr->expr_type == EXPR_NULL)
+   continue;
+ 
+   a = gfc_expr_attr (cons->expr);
+ 
+   if (!a.pointer && !a.target)
+   {
+ t = FAILURE;
+ gfc_error ("The element in the derived type constructor at %L, "
+"for pointer component '%s' should be a POINTER or "
+"a TARGET", &cons->expr->where, comp->name);
+   }
  }

return t;


-- 


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



[Bug fortran/29115] ICE in structure constructor for array, ponter component with non-pointer data

2006-09-18 Thread pault at gcc dot gnu dot org


--- Comment #2 from pault at gcc dot gnu dot org  2006-09-18 07:49 ---
This fixes it:

Index: gcc/fortran/resolve.c
===
*** gcc/fortran/resolve.c   (revision 117013)
--- gcc/fortran/resolve.c   (working copy)
*** resolve_structure_cons (gfc_expr * expr)
*** 608,613 
--- 608,625 
  continue;
}

+   if (comp->pointer
+   && !((cons->expr->expr_type == EXPR_VARIABLE
+   || cons->expr->expr_type == EXPR_VARIABLE)
+ && (cons->expr->symtree->n.sym->attr.pointer
+   || cons->expr->symtree->n.sym->attr.target)))
+   {
+ t = FAILURE;
+ gfc_error ("The element in the derived type constructor at %L, "
+"for pointer component '%s' should be a POINTER or "
+"a TARGET", &cons->expr->where, comp->name);
+   }
+
/* If we don't have the right type, try to convert it.  */

if (!gfc_compare_types (&cons->expr->ts, &comp->ts))

I have yet to regtest or to write a suitable testcase.

Paul


-- 

pault at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2006-09-17 15:32:08 |2006-09-18 07:49:34
   date||


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



[Bug fortran/29115] ICE in structure constructor for array, ponter component with non-pointer data

2006-09-17 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2006-09-17 15:32 ---
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2006-09-17 15:32:08
   date||


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