[Bug fortran/35846] ICE on nested character constructors

2008-09-21 Thread domob at gcc dot gnu dot org


--- Comment #6 from domob at gcc dot gnu dot org  2008-09-21 15:35 ---
Subject: Bug 35846

Author: domob
Date: Sun Sep 21 15:33:37 2008
New Revision: 140529

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=140529
Log:
2008-09-21  Daniel Kraft  [EMAIL PROTECTED]

PR fortran/35846
* trans.h (gfc_conv_string_length): New argument `expr'.
* trans-expr.c (flatten_array_ctors_without_strlen): New method.
(gfc_conv_string_length): New argument `expr' that is used in a new
special case handling if cl-length is NULL.
(gfc_conv_subref_array_arg): Pass expr to gfc_conv_string_length.
* trans-array.c (gfc_conv_expr_descriptor): Ditto.
(gfc_trans_auto_array_allocation): Pass NULL as new expr.
(gfc_trans_g77_array), (gfc_trans_dummy_array_bias): Ditto.
(gfc_trans_deferred_array): Ditto.
(gfc_trans_array_constructor): Save and restore old values of globals
used for bounds checking.
* trans-decl.c (gfc_trans_dummy_character): Ditto.
(gfc_trans_auto_character_variable): Ditto.

2008-09-21  Daniel Kraft  [EMAIL PROTECTED]

PR fortran/35846
* gfortran.dg/nested_array_constructor_1.f90: New test.
* gfortran.dg/nested_array_constructor_2.f90: New test.
* gfortran.dg/nested_array_constructor_3.f90: New test.
* gfortran.dg/nested_array_constructor_4.f90: New test.
* gfortran.dg/nested_array_constructor_5.f90: New test.
* gfortran.dg/nested_array_constructor_6.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/nested_array_constructor_1.f90
trunk/gcc/testsuite/gfortran.dg/nested_array_constructor_2.f90
trunk/gcc/testsuite/gfortran.dg/nested_array_constructor_3.f90
trunk/gcc/testsuite/gfortran.dg/nested_array_constructor_4.f90
trunk/gcc/testsuite/gfortran.dg/nested_array_constructor_5.f90
trunk/gcc/testsuite/gfortran.dg/nested_array_constructor_6.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/35846] ICE on nested character constructors

2008-09-21 Thread domob at gcc dot gnu dot org


--- Comment #7 from domob at gcc dot gnu dot org  2008-09-21 15:36 ---
Fixed on trunk.


-- 

domob at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug fortran/35846] ICE on nested character constructors

2008-09-20 Thread domob at gcc dot gnu dot org


--- Comment #5 from domob at gcc dot gnu dot org  2008-09-20 11:52 ---
After coming back to this bug, I believe the problem is that gfc_conv_expr
takes care of finding out string lengths' for things like TRIM(x) which don't
have a cl-length, but gfc_conv_expr_descriptor which is called e.g. for the
array constructors does not do so and calls gfc_conv_string_length with a cl
whose length is NULL.

As the problem seems to be specific to array constructors and all array
constructor elements must have the same character length, I propose to re-use
gfc_conv_expr in gfc_conv_string_length to find out the string length if it is
NULL by taking the first element of each array constructor and then calling
gfc_conv_expr to get the result's string_length.

I'll submit a patch shortly if no further problems occur.


-- 


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



[Bug fortran/35846] ICE on nested character constructors

2008-09-18 Thread domob at gcc dot gnu dot org


-- 

domob at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |domob at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2008-04-13 20:33:00 |2008-09-18 18:22:59
   date||


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



[Bug fortran/35846] ICE on nested character constructors

2008-05-21 Thread d at domob dot eu


--- Comment #3 from d at domob dot eu  2008-05-21 15:06 ---
Created an attachment (id=15663)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15663action=view)
Testcase without nested array constructors

Actually, this does not depend on nested array constructors as this test-case
proves (and also has nothing to do with the globals used for bounds-checking,
it seems).

I believe the problem is that the gfc_expr* corresponding to the concatenation
doesn't have a cl-length set on its ts (because the arguments don't have one
when resolution is called); this NULL later causes the ICE.  When this
expression turns up in an assignment, this does not matter as the expected
length is known from the target's character length definition.

But when there is no expected charlen (like in the nested constructor or in a
function call as in this test) it is needed and the NULL pointer dereferenced. 
Hopefully I can soon come up with a real solution to this patch.


-- 


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



[Bug fortran/35846] ICE on nested character constructors

2008-05-21 Thread d at domob dot eu


--- Comment #4 from d at domob dot eu  2008-05-21 15:06 ---
Created an attachment (id=15664)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15664action=view)
Testcase without nested array constructors

Actually, this does not depend on nested array constructors as this test-case
proves (and also has nothing to do with the globals used for bounds-checking,
it seems).

I believe the problem is that the gfc_expr* corresponding to the concatenation
doesn't have a cl-length set on its ts (because the arguments don't have one
when resolution is called); this NULL later causes the ICE.  When this
expression turns up in an assignment, this does not matter as the expected
length is known from the target's character length definition.

But when there is no expected charlen (like in the nested constructor or in a
function call as in this test) it is needed and the NULL pointer dereferenced. 
Hopefully I can soon come up with a real solution to this problem.


-- 


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



[Bug fortran/35846] ICE on nested character constructors

2008-05-20 Thread d at domob dot eu


--- Comment #2 from d at domob dot eu  2008-05-20 07:33 ---
Created an attachment (id=15655)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15655action=view)
Hackish patch

It seems the problem lies in gfc_conv_string_length, that can be called with a
gfc_charlen whose length is NULL.   This patch is somewhat a prove of concept
of this, just creating a dummy length if it is NULL there; this prevents the
ICEs described above.

Of course this is surely not the correct place to do this initialization, I'll
try to find it out later and work out a real patch.


-- 


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



[Bug fortran/35846] ICE on nested character constructors

2008-04-13 Thread tkoenig at gcc dot gnu dot org


--- Comment #1 from tkoenig at gcc dot gnu dot org  2008-04-13 20:32 ---
Created an attachment (id=15474)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15474action=view)
Backtrace

Confirmed.  Backtrace is attached.


-- 


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



[Bug fortran/35846] ICE on nested character constructors

2008-04-13 Thread tkoenig at gcc dot gnu dot org


-- 

tkoenig at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2008-04-13 20:33:00
   date||


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