- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
the following code is in my opinion wrongly rejected:
print *, [ integer :: ], 1 ! OK print *, [ integer :: [ integer :: ], 1 ] ! Fail end
% ifort bug.f90 -stand f08 bug.f90(2): error #7203: An ac-value-list of an array-constructor must contain at least one ac-value. print *, [ integer :: [ integer :: ], 1 ] ! Fail --------------------------^ compilation aborted for bug.f90 (code 1)
The code is accepted by the Cray compiler.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree - bug. The array constructor with a type-spec but no ac-value-list creates a zero-length array. The second statement's outer array constructor has as its values the empty array and 1 - in this case the empty array would not contribute to the array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have opened a bug report for it. The track ID is DPD200419522.
Thanks,
Xiaoping Duan
Intel Customer Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Can you comment on the validity of (I assume not valid):
print *, [ integer :: [ real :: 1.0], 1 ]
Does this imply a real to integer conversion, or does it choke with incompatible types?
Note, in lieu of the inner real one might specify a type that has no implicit conversion to outer type.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim, that would be allowed and it would convert the REAL value(s) to INTEGER according to the rules for intrinsic assignment. The text from the standard related to this is:
C4104 (R469) 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 7.8.
Table 7.8: Type conformance for the intrinsic assignment statement
Type of the variable Type of expr
integer integer, real, complex
real integer, real, complex
complex integer, real, complex
character character
logical logical
derived type same derived type as the variable

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page