PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Passing unlimited polymorphic object in SELECT TYPE clause

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
delete000



Joined: 03 Jul 2012
Posts: 4

PostPosted: Fri Oct 19, 2012 2:16 am    Post subject: Passing unlimited polymorphic object in SELECT TYPE clause Reply with quote

Hi all,

can someone please tell me what's wrong with the following code and how to fix it? It works with recent versions of ifort:

Code:

PROGRAM test_pass_unl

  TYPE new
    INTEGER, DIMENSION(:), ALLOCATABLE :: i
  END TYPE
  CLASS(*), ALLOCATABLE :: test
  TYPE(new) :: n

  ALLOCATE(n%i(5))
  ALLOCATE(test,SOURCE=n)
  SELECT TYPE(test)
  TYPE IS (new)
    CALL pass(test)
  CLASS DEFAULT
    PRINT*,'whooops!'
  END SELECT

CONTAINS

  SUBROUTINE pass(arg)
    TYPE(new) :: arg
    PRINT*,arg%i
  END SUBROUTINE pass


END PROGRAM test_pass_unl


Here's what I get when I try to compile:

Code:

$ pgfortran -V

pgfortran 11.1-0 64-bit target on x86-64 Linux -tp penryn
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.
$
$
$ pgfortran -O3 -Bstatic test.f90 -o test
PGF90-S-0188-Argument number 1 to pass: type mismatch (test.f90: 13)
  0 inform,   0 warnings,   1 severes, 0 fatal for test_pass_unl


Many thanks in advance.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5815
Location: The Portland Group Inc.

PostPosted: Fri Oct 19, 2012 8:41 am    Post subject: Reply with quote

Hi delete000,

The code is fine and will compile with PGI versions 11.2 and later. We were just adding F2003 features in the early 11.x releases and 11.1 was just a bit early with for this one.

- Mat
Back to top
View user's profile
delete000



Joined: 03 Jul 2012
Posts: 4

PostPosted: Fri Oct 19, 2012 8:58 am    Post subject: Reply with quote

Hi Mat,

thank you very much for your help.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group