This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR fortran/19269 (partial fix): Lengths of reshaped arrays


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]