- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In case this is an oversight, Fortran 2003's ability to use an unallocated entity for the component specification that corresponds to an allocatable component in a structure constructor does not appear to have been implemented in current compilers. If only I had of known this yesterday!
MODULE m PRIVATE TYPE, PUBLIC :: t INTEGER, ALLOCATABLE :: comp END TYPE t END MODULE m PROGRAM p USE m IMPLICIT NONE TYPE(t) :: x, y, z INTEGER, ALLOCATABLE :: not_allocated x = t(NULL()) ! ok. y = t(1) ! ok. z = t(not_allocated) ! explodes. PRINT *, ALLOCATED(x%comp), ALLOCATED(y%comp), ALLOCATED(z%comp) END PROGRAM p
F2003 4.5.9 para 6 or so - "If a component of a derived type is allocatable, the corresponding constructor expression shall either be ... an allocatable entity of the same rank ... If the expression is an allocatable entity, the corresponding component of the constructor has the same allocation status as that allocatable entity and, if it is allocated, the same dynamic type, bounds and value."
This missing feature has thwarted my evil plans to submit an ICE that occurs with some of the most horrible (but still F2003 conforming, bar 1.4(5)) source that your compiler support people will have ever seen. I am sure you are all very disappointed.
(Oops - forgot this bit...
>ifort /check:all /warn:all /standard-semantics /traceback "2016-06-05 allocatable-component.f90" && "2016-06-05 allocatable-component.exe" Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.3.207 Build 20160415 Copyright (C) 1985-2016 Intel Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 14.00.23918.0 Copyright (C) Microsoft Corporation. All rights reserved. "-out:2016-06-05 allocatable-component.exe" -subsystem:console -incremental:no "2016-06-05 allocatable-component.obj" forrtl: severe (157): Program Exception - access violation Image PC Routine Line Source 2016-06-05 alloca 000000013F071238 MAIN__ 16 2016-06-05 allocatable-component.f90 2016-06-05 alloca 000000013F0BD28E Unknown Unknown Unknown 2016-06-05 alloca 000000013F0BDB80 Unknown Unknown Unknown kernel32.dll 00000000776759BD Unknown Unknown Unknown ntdll.dll 00000000778AA2E1 Unknown Unknown Unknown
)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>... thwarted my evil plans
So you missed it by "this much"? (Maxwell Smart)
IanH you are one of this, if not the, forum's most prolific bug catcher. Thank you for all your efforts.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - escalated as issue DPD200411531. I think this was an oversight.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In case this is an oversight, Fortran 2003's ability to use an unallocated entity for the component specification that corresponds to an allocatable component in a structure constructor does not appear to have been implemented in current compilers.
I want to get this printed on a T-Shirt and on the back say:
IF THIS MAKES SENSE TO YOU MIT WANTS YOU!
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page