- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following snippet, when compiled using ifort 13.0.0, gives surprising results.
[fortran]
MODULE abc
IMPLICIT NONE
TYPE :: InnerPoly
END TYPE InnerPoly
TYPE :: Container
CLASS(InnerPoly), ALLOCATABLE :: item
END TYPE Container
TYPE :: Base
TYPE(Container), ALLOCATABLE :: cont(:)
END TYPE Base
END MODULE abc
PROGRAM OhNoNowICantGrow
USE abc
IMPLICIT NONE
CLASS(Base), ALLOCATABLE :: a
TYPE(Container), ALLOCATABLE :: tmp(:)
!****
ALLOCATE(a)
ALLOCATE(a%cont(1))
! allocate bigger, assign, swap idiom for array expansion.
ALLOCATE(tmp(SIZE(a%cont)+1))
PRINT "('size of tmp:',I0)", SIZE(tmp)
tmp(:SIZE(a%cont)) = a%cont
CALL MOVE_ALLOC(tmp, a%cont)
PRINT "('size of a%cont:',I0)", SIZE(a%cont)
END PROGRAM OhNoNowICantGrow
[/fortran]
[plain]
>ifort /check:all /warn:all /standard-semantics "OhNoNowICantGrow.f90" && "OhNoNowICantGrow.exe"
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 13.0.0.089 Build 20120731
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:OhNoNowICantGrow.exe
-subsystem:console
OhNoNowICantGrow.obj
size of tmp:2
size of a%cont:1
[/plain]
Bigger examples throw access violations.
Advice on possible work arounds much appreciated - that pattern for expanding an array is in very common use in my code.
(Tips on how to post code examples in forum text also appreciated! (Later edit to give the syntax highlighting instructions a whirl.))
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So.... 14 isn't going to be my lucky number with respect to polymorphic components?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It might be. I will check on your specific issue on Monday.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your program revealed more than one problem with the compiler. One has been fixed, another is still being worked on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The second problem has now been fixed. The fix should appear in an October update.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page