https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108651

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Scott Boyce from comment #3)
> No its not correct because the

Yes, it is the correct behavior. Please see 18-007r1.pdf, p.57.

   7.4.3.1 Integer type
   ...
   Any integer value can be represented as a signed-int-literal-constant.
   ...
   The optional kind type parameter following digit-string
   specifies the kind type parameter of the integer constant;
   if it does not appear, the constant is default integer.

8258803693257250632 has default integer kind when it is parsed. 
8258803693257250632_int64 has the integer type of integer(int64).

Now check Sec. 7.8 "Construction of array values".


   R773 ac-value  is expr
                  or ac-implied-do

8258803693257250632 is an expr.

   C7111 (R770) If type-spec specifies an intrinsic type, each
      ac-value expression in the array-constructor shall be of
      an intrinsic type that is in type conformance with a
      variable of type type-spec as specified in Table 10.8.

8258803693257250632 meets the requirements of type conformance.

   18-007r1.pdf, p. 89.  If type-spec appears, it specifies the
   declared type and type parameters of the array constructor.
   Each ac-value expression in the array-constructor shall be
   compatible with intrinsic assignment to a variable of this type
   and type parameters.  Each value is converted to the type and
   type parameters of the array-constructor in accordance
   with the rules of intrinsic assignment (10.2.1.3).

Now, read that last sentence again, and then go read 10.2.1.3.
8258803693257250632 is treated as the right-hand-side of an
intrinsic assignment such as

  integer(int64) x
  x = 8258803693257250632

This won't work because mathematically 8258803693257250632 
exceeds huge(1).

You have shown the correct way to do the array constructor,
and in that case the type-spec within the constructor is
redundant.

Reply via email to