This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR fortran/19269 (partial fix): Lengths of reshaped arrays
- From: Richard Sandiford <richard at codesourcery dot com>
- To: Paul Brook <paul at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Tue, 06 Sep 2005 21:26:11 +0100
- Subject: Re: PR fortran/19269 (partial fix): Lengths of reshaped arrays
- References: <87zmqqp1r4.fsf@talisman.home><200509061837.49771.paul@codesourcery.com>
Paul Brook <paul@codesourcery.com> writes:
>> (b) the character length of the array is the maximum of every individual
>> element.
>
> I'm not sure about this because...
>
>> + (/ 'a', 'bee', 'cedar', 'dog' /)
>
> This is illegal.
> From Section 4.5 (Construction of array values):
> "If the ac-value expressions are of type character, each ac-value
> expression in the array constructor shall have the same character length
> parameter.
>
> Is this an extension we provide that I've forgotten about?
Unknown, but resolve_character_array_descriptor certainly goes
out of its way to choose the maximum length, so I assumed it
was supported.
I hadn't expected the testcase to be so controversial though. ;)
The varying lengths isn't anything to do with the bug. It's just
something I threw in for emphasis. If (despite the maximum code
in resolve_character_array_descriptor) you really don't want to
support this, then would the patch be OK with a testcase that tests
for equal-length elements?
The bug here is to do with internal representation. The typespecs
for constant strings have a null gfc_charlen, so copying the typespec
from one element to the whole array causes a segfault.
Richard