[Bug fortran/47350] Deferred string length: ALLOCATE should allow MOLD=

2011-02-02 Thread dnovillo at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47350

--- Comment #4 from Diego Novillo dnovillo at gcc dot gnu.org 2011-02-02 
17:59:40 UTC ---
Author: dnovillo
Date: Wed Feb  2 17:59:29 2011
New Revision: 169666

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=169666
Log:
2011-01-28  Paul Thomas  pa...@gcc.gnu.org
Tobias Burnus  bur...@gcc.gnu.org

PR fortran/45170
PR fortran/35810
PR fortran/47350
* interface.c (compare_actual_formal): An allocatable or pointer
deferred length actual is only allowed if the formal argument
is also deferred length. Clean up whitespace.
* trans-expr.c (gfc_conv_procedure_call): Pass string length for
deferred character length formal arguments by reference. Do the
same for function results.
(gfc_trans_pointer_assignment): Do not do runtime check of lhs
and rhs character lengths, if deferred length lhs.  In this case
set the lhs character length to that of the rhs.
(gfc_conv_string_parameter): Remove assert that string length is
an integer type.
(is_scalar_reallocatable_lhs): New function.
(alloc_scalar_allocatable_for_assignment): New function.
(gfc_trans_assignment_1): Call above new function. If the rhs is
a deferred character length itself, makes ure that the function
is called before reallocation, so that the length is available.
(gfc_trans_asssignment): Remove error about assignment to
deferred length character variables.
* gfortran.texi : Update entry about (re)allocation on
assignment.
* trans-stmt.c (gfc_trans_allocate): Add code to handle deferred
length character variables.
* module.c (mio_typespec): Transfer deferred characteristic.
* trans-types.c (gfc_get_function_type): New code to generate
hidden typelist, so that those character lengths that are
passed by reference get the right type.
* resolve.c (resolve_contained_fntype): Supress error for
deferred character length functions.
(resolve_function, resolve_fl_procedure) The same.
(check_symbols): Remove the error that support for
entity with deferred type parameter is not yet implemented.
(resolve_fl_derived): The same.
match.c (alloc_opt_list): Allow MOLD for deferred length object.
* trans-decl.c (gfc_get_symbol_decl): For deferred character
length dummies, generate a local variable for string length.
(create_function_arglist): Hidden length can be a pointer.
(gfc_trans_deferred_vars): For deferred character length
results and dummies, assign the string length to the local
variable from the hidden argument on entry and the other way
round on exit, as appropriate.

2011-01-28  Paul Thomas  pa...@gcc.gnu.org
Tobias Burnus  bur...@gcc.gnu.org

PR fortran/45170
PR fortran/35810
PR fortran/47350
* gfortran.dg/realloc_on_assign_3.f03: New test.
* gfortran.dg/realloc_on_assign_4.f03: New test.
* gfortran.dg/realloc_on_assign_5.f90: New test.
* gfortran.dg/allocatable_function_5.f90: New test.
* gfortran.dg/allocate_deferred_char_scalar_1.f90: New test.
* gfortran.dg/deferred_type_param_2.f90: Remove two not yet
implemented dg-errors.

Added:
   
branches/google/integration/gcc/testsuite/gfortran.dg/allocate_deferred_char_scalar_1.f03
   
branches/google/integration/gcc/testsuite/gfortran.dg/realloc_on_assign_3.f03
   
branches/google/integration/gcc/testsuite/gfortran.dg/realloc_on_assign_4.f03
Modified:
branches/google/integration/gcc/fortran/ChangeLog
branches/google/integration/gcc/fortran/gfortran.texi
branches/google/integration/gcc/fortran/interface.c
branches/google/integration/gcc/fortran/match.c
branches/google/integration/gcc/fortran/module.c
branches/google/integration/gcc/fortran/resolve.c
branches/google/integration/gcc/fortran/trans-decl.c
branches/google/integration/gcc/fortran/trans-expr.c
branches/google/integration/gcc/fortran/trans-stmt.c
branches/google/integration/gcc/fortran/trans-types.c
branches/google/integration/gcc/testsuite/ChangeLog
   
branches/google/integration/gcc/testsuite/gfortran.dg/deferred_type_param_2.f90


[Bug fortran/47350] Deferred string length: ALLOCATE should allow MOLD=

2011-02-02 Thread dnovillo at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47350

--- Comment #5 from Diego Novillo dnovillo at gcc dot gnu.org 2011-02-02 
18:04:44 UTC ---
Author: dnovillo
Date: Wed Feb  2 18:04:21 2011
New Revision: 169697

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=169697
Log:
2011-01-30  Paul Thomas  pa...@gcc.gnu.org

PR fortran/47523
* trans-expr.c (gfc_trans_assignment_1): If the rhs is an op
expr and is assigned to a deferred character length scalar,
make sure that the function is called before reallocation,
so that the length is available. Include procedure pointer
and procedure pointer component rhs as well.

2011-01-30  Paul Thomas  pa...@gcc.gnu.org

PR fortran/47523
* trans-expr.c (gfc_trans_assignment_1): If the rhs is an op
expr and is assigned to a deferred character length scalar,
make sure that the function is called before reallocation,
so that the length is available. Include procedure pointer
and procedure pointer component rhs as well.

PR fortran/45170
PR fortran/35810
PR fortran/47350
* gfortran.dg/allocatable_function_5.f90: New test not added by
mistake on 2011-01-28.

Added:
   
branches/google/integration/gcc/testsuite/gfortran.dg/allocatable_function_5.f90
   
branches/google/integration/gcc/testsuite/gfortran.dg/realloc_on_assign_5.f03
Modified:
branches/google/integration/gcc/fortran/ChangeLog
branches/google/integration/gcc/fortran/trans-expr.c
branches/google/integration/gcc/testsuite/ChangeLog


[Bug fortran/47350] Deferred string length: ALLOCATE should allow MOLD=

2011-01-30 Thread pault at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47350

--- Comment #3 from Paul Thomas pault at gcc dot gnu.org 2011-01-30 17:50:05 
UTC ---
Author: pault
Date: Sun Jan 30 17:50:01 2011
New Revision: 169413

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=169413
Log:
2011-01-30  Paul Thomas  pa...@gcc.gnu.org

PR fortran/47523
* trans-expr.c (gfc_trans_assignment_1): If the rhs is an op
expr and is assigned to a deferred character length scalar,
make sure that the function is called before reallocation,
so that the length is available. Include procedure pointer
and procedure pointer component rhs as well.

2011-01-30  Paul Thomas  pa...@gcc.gnu.org

PR fortran/47523
* trans-expr.c (gfc_trans_assignment_1): If the rhs is an op
expr and is assigned to a deferred character length scalar,
make sure that the function is called before reallocation,
so that the length is available. Include procedure pointer
and procedure pointer component rhs as well.

PR fortran/45170
PR fortran/35810
PR fortran/47350
* gfortran.dg/allocatable_function_5.f90: New test not added by
mistake on 2011-01-28.



Added:
trunk/gcc/testsuite/gfortran.dg/allocatable_function_5.f90
trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_5.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog


[Bug fortran/47350] Deferred string length: ALLOCATE should allow MOLD=

2011-01-28 Thread pault at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47350

--- Comment #1 from Paul Thomas pault at gcc dot gnu.org 2011-01-28 13:53:25 
UTC ---
Author: pault
Date: Fri Jan 28 13:53:19 2011
New Revision: 169356

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=169356
Log:
2011-01-28  Paul Thomas  pa...@gcc.gnu.org
Tobias Burnus  bur...@gcc.gnu.org

PR fortran/45170
PR fortran/35810
PR fortran/47350
* interface.c (compare_actual_formal): An allocatable or pointer
deferred length actual is only allowed if the formal argument
is also deferred length. Clean up whitespace.
* trans-expr.c (gfc_conv_procedure_call): Pass string length for
deferred character length formal arguments by reference. Do the
same for function results.
(gfc_trans_pointer_assignment): Do not do runtime check of lhs
and rhs character lengths, if deferred length lhs.  In this case
set the lhs character length to that of the rhs.
(gfc_conv_string_parameter): Remove assert that string length is
an integer type.
(is_scalar_reallocatable_lhs): New function.
(alloc_scalar_allocatable_for_assignment): New function.
(gfc_trans_assignment_1): Call above new function. If the rhs is
a deferred character length itself, makes ure that the function
is called before reallocation, so that the length is available.
(gfc_trans_asssignment): Remove error about assignment to
deferred length character variables.
* gfortran.texi : Update entry about (re)allocation on
assignment.
* trans-stmt.c (gfc_trans_allocate): Add code to handle deferred
length character variables.
* module.c (mio_typespec): Transfer deferred characteristic.
* trans-types.c (gfc_get_function_type): New code to generate
hidden typelist, so that those character lengths that are
passed by reference get the right type.
* resolve.c (resolve_contained_fntype): Supress error for
deferred character length functions.
(resolve_function, resolve_fl_procedure) The same.
(check_symbols): Remove the error that support for
entity with deferred type parameter is not yet implemented.
(resolve_fl_derived): The same.
match.c (alloc_opt_list): Allow MOLD for deferred length object.
* trans-decl.c (gfc_get_symbol_decl): For deferred character
length dummies, generate a local variable for string length.
(create_function_arglist): Hidden length can be a pointer.
(gfc_trans_deferred_vars): For deferred character length
results and dummies, assign the string length to the local
variable from the hidden argument on entry and the other way
round on exit, as appropriate.

2011-01-28  Paul Thomas  pa...@gcc.gnu.org
Tobias Burnus  bur...@gcc.gnu.org

PR fortran/45170
PR fortran/35810
PR fortran/47350
* gfortran.dg/realloc_on_assign_3.f03: New test.
* gfortran.dg/realloc_on_assign_4.f03: New test.
* gfortran.dg/realloc_on_assign_5.f90: New test.
* gfortran.dg/allocatable_function_5.f90: New test.
* gfortran.dg/allocate_deferred_char_scalar_1.f90: New test.
* gfortran.dg/deferred_type_param_2.f90: Remove two not yet
implemented dg-errors.


Added:
trunk/gcc/testsuite/gfortran.dg/allocate_deferred_char_scalar_1.f03
trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_3.f03
trunk/gcc/testsuite/gfortran.dg/realloc_on_assign_4.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/gfortran.texi
trunk/gcc/fortran/interface.c
trunk/gcc/fortran/match.c
trunk/gcc/fortran/module.c
trunk/gcc/fortran/resolve.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
trunk/gcc/testsuite/gfortran.dg/deferred_type_param_2.f90


[Bug fortran/47350] Deferred string length: ALLOCATE should allow MOLD=

2011-01-28 Thread burnus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47350

Tobias Burnus burnus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||FIXED

--- Comment #2 from Tobias Burnus burnus at gcc dot gnu.org 2011-01-28 
14:52:58 UTC ---
FIXED for the 4.6 trunk.