This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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


Richard E Maine wrote:
> On Sep 6, 2005, at 2:37 PM, Tobias Schlüter wrote:
> 
> 
>>For PARAMETERs the characters may have different length,
> 
> 
> Not in the standard. In fact, the standard doesn't have much in the way 
> of special cases for PARAMETERS. Mostly they fall under the general 
> category of initialization expressions, which don't allow this. The 
> only thing I can think of that is special for PARAMETERS is the way 
> that length=* can "pick up" the length from the expression, but that 
> doesn't mean that the expression can include array constructors that 
> have ragged lengths.

Given that, the code in resolve_character_array_constructor indeed looks
supicious.

Checking CVS history confirms that together with this code the following
testcase was introduced:
gfortran.dg/pr15959.f90:
   ! { dg-do run }
   ! Test initializer of character array. PR15959
   character (*), parameter :: a (1:2) = (/'ab', 'abc'/)
   if (a(2) .ne. 'abc') call abort()
   end
This is not valid code, according to what Richard said.

Feng Wang, did you intentionally introduce a language extension, or was this a
mistake?  In the former case we might want to discuss the merits (and we
should dprobably document it), in the latter case I think we should fix it (or
at least open a PR :-)

- Tobi


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