Character array constructor

I did mean for the “canonical” form to apply to bounds as well:

    integer, allocatable :: n(:), tmp(:)
    n = [ 1, 2, 3 ]
    print *, "lbound(n) = ", lbound(n, dim=1)
    allocate( tmp(-1:1) )
    tmp = n
    call move_alloc( from=tmp, to=n )
    print *, "lbound(n) following move_alloc: ", lbound(n, dim=1)
end
C:\temp>p.exe
 lbound(n) =            1
 lbound(n) following move_alloc:           -1

Indeed , as has been mentioned upthread already, Intel Fortran supports what is desired by OP as an (unintended?) extension:

   character(len=:), allocatable :: s(:)
   s = [ "a", "bb", "ccc" ]
   print *, s
end 
C:\temp>ifort /standard-semantics /free p.f
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.8.0 Build 20221119_000000
Copyright (C) 1985-2022 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.31.31105.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:p.exe
-subsystem:console
p.obj

C:\temp>p.exe
 a  bb ccc

Deliberate, not unintended.

A comment at GitHub on the issue by Peter Klausler said similar things:

As complete implementations of the language must already be capable of evaluating every effective item in an array constructor into an expanding pool of dynamic memory in worst case scenarios – think about an array constructor with implied DO loops with dynamic bounds, or items that are function results of dynamic shape – this request shouldn’t require too much extra work in a compiler or its runtime support library.

If the LEN of the character constructor was set to the largest LEN of elements in the constructor known at compile time – literals and PARAMETERs – I think that would provide the functionality most people want. Ideally compilers would have an option to warn at run-time if truncation occurred in a character constructor.

I think this is one of those cases where the standard is not clear. If it were written as tmp(:)=n, then no reallocation should occur and the lower bound should remain -1. But written as tmp=n, the standard allows reallocation, in which case the lower bound afterwards would be 1, not -1.

Sorrty to raise the matter of jagged character array constructors again but @sblionel told us that Intel Fortran supports them. Perhaps they could be allowed in f202y. I don’t use them now because I usually try as many compilers as I can when testing a new program.

Unlikely, as the standards committee already considered this and rejected it in favor of the current ability to specify the common length.