This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31215] ICE on valid code with gfortran
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Mar 2007 10:09:23 -0000
- Subject: [Bug fortran/31215] ICE on valid code with gfortran
- References: <bug-31215-6642@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pault at gcc dot gnu dot org 2007-03-20 10:09 -------
> > All compilers I know reject this code, except g95. The list includes Lahey,
> > which is a reason for me to doubt whether this code is legal or not.
The code is legal because the interface to test2 only needs the characteristics
of the result to convert the actual arguments and to allocate space for the
temporary.
>
> In any case, an ICE is an error.
>
Yes indeed!
This is one of the most difficult diagnostic problems that I have faced with
gfortran. It should be noted that
character(10) :: ch(3)
...
ch = test2(0)
compiles and runs correctly.
After a lot of head scratching and adding diagnostics all over the place, I
found that the reason for this is that the compiler is able to take the lhs to
determine the scalarization loop size, whereas this is not possible for
write(*,*) len(test2(10))
The compiler is failing in trans-array.c (gfc_set_loop_bounds_from_array_spec),
during the calls to gfc_apply_interface_mapping. If the block for upper is
substituted by upper = gfc_index_one_node, the code compiles; it cannot run
correctly because the temporary descriptor does not have the right bounds and
the data allocation is incorrect.
Apparently, the interface mapping is failing to substitute the actual values
correctly and should, in any case treat LEN as a special case by substituting
LEN (arg) by the expression for the character length of the argument.
I am on to it!
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu dot org
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-03-20 10:09:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31215