Polymorphic pointer arguments and associated

Polymorphic pointer arguments and associated

There may be polymorphic whiz-jiggery going on that is confusing me, but something doesn't seem right with associated when applied to polymorphic pointer dummy arguments.

PROGRAM associate_is_disassociated_from_reality
  TYPE :: Parent
    ! Comment me out for some access violation fun.
    INTEGER :: just_so_im_not_zero_sized
  END TYPE Parent
  CLASS(Parent), POINTER :: p
  CALL proc(p)
  SUBROUTINE proc(ptr)
    CLASS(Parent), INTENT(IN), POINTER :: ptr
    CLASS(Parent), POINTER :: a
    ! T and F below assume component is still part of the type.
    PRINT *, ASSOCIATED(ptr)        ! T - Ok.
    PRINT *, ASSOCIATED(ptr, ptr)   ! F - Not Ok.
    PRINT *, ASSOCIATED(p, ptr)     ! T - Ok.
    PRINT *, ASSOCIATED(ptr, p)     ! F - Not Ok.
    a => ptr
    PRINT *, ASSOCIATED(a, ptr)     ! T - Ok.
    PRINT *, ASSOCIATED(ptr, a)     ! F - Not Ok.
END PROGRAM associate_is_disassociated_from_reality
>ifort /check:all /warn:all /standard-semantics "2014-04-28 simple.f90" & "2014-04-28 simple.exe"
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version Build 20140130
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

"-out:2014-04-28 simple.exe"
"2014-04-28 simple.obj"

Comment out the component in the type and any of the associated intrinsics that reference the ptr thing as the POINTER argument of the ASSOCIATED intrinsic start exploding (noting that the rules around zero sized sequences change the results that should be expected, and noting that I'm noting that because I'm always excited when I learn something new).

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

What fun! Escalated as issue DPD200256015. Thanks.

Steve - Intel Developer Support

These issues will all be fixed for the 15.0 release.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today