Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Automatic allocation of allocatable scalars with allocatable components

$
0
0

Is this supported?  Some tests here with 13.1.0 indicate "sort of".

PROGRAM AllocatableScalars
  IMPLICIT NONE
  
  TYPE :: TypeOne
    INTEGER :: int1
  END TYPE TypeOne
  
  TYPE :: TypeTwo
    INTEGER :: int2
    CHARACTER(:), ALLOCATABLE :: str2
  END TYPE TypeTwo
  
  TYPE(TypeOne), ALLOCATABLE :: lhs1
  TYPE(TypeOne) :: rhs1
  
  TYPE(TypeTwo), ALLOCATABLE :: lhs2
  TYPE(TypeTwo) :: rhs2
  
  !****
  
  rhs1%int1 = 1
  lhs1 = rhs1               ! Ok.
  PRINT *, lhs1%int1
  
  rhs2%int2 = 2
  rhs2%str2 = 'Two'  lhs2 = rhs2               ! Explodes.
  PRINT *, lhs2%int2, lhs2%str2
END PROGRAM AllocatableScalars

>ifort /check:all /warn:all /standard-semantics /traceback "2013-03-04 AllocatableScalars.f90"&& "2013-03-04 AllocatableScalars.exe"
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 13.1.0.149 Build 20130118
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.
"-out:2013-03-04 AllocatableScalars.exe"
-subsystem:console
-incremental:no
"2013-03-04 AllocatableScalars.obj" 1
forrtl: severe (408): fort: (7): Attempt to use pointer LHS2 when it is not associated with a target
Image              PC        Routine            Line        Source
2013-03-04 Alloca  00C18830  Unknown               Unknown  Unknown
2013-03-04 Alloca  00BE2736  Unknown               Unknown  Unknown
2013-03-04 Alloca  00BD4CF2  Unknown               Unknown  Unknown
2013-03-04 Alloca  00BD5463  Unknown               Unknown  Unknown
2013-03-04 Alloca  00BD1244  _MAIN__                    27  2013-03-04 AllocatableScalars.f90
2013-03-04 Alloca  00C197E3  Unknown               Unknown  Unknown
2013-03-04 Alloca  00C04B24  Unknown               Unknown  Unknown
kernel32.dll       76F2D2E9  Unknown               Unknown  Unknown
ntdll.dll          771C1603  Unknown               Unknown  Unknown
ntdll.dll          771C15D6  Unknown               Unknown  Unknown

This feels a little familiar - so apologies if it is a repeat report.


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>