- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll have to excuse me if I do not format correctly, this is my first post. I am recieving an error when trying to use a function that returns a pointer to some class data and am unclear why this would happen (ifort (IFORT) 11.1 20091012). Let me draw up some modules.
The compiling error I get is "error #6678: When the target is an expression it must deliver a pointer result." at the line marked with the '!<<----'. What I don't understand is the function 'GetB' is returning a pointer result, 'type(B), pointer', and is almost exactly like the function 'GetPtrB' except it is defined in the class, not as a subroutine accessing data in a type. I have done some research online, and as far as I can tell, I am using the function correctly. Any help is greatly appreciated, and please ask any questions if you need more clarification.
[plain]module typeAmodule
implicit none
private
public :: A, GetPtrB
type A
private
type(B), pointer:: ptrB
end type
contains
function GetPtrB(typA) return(res)
type(A)::typA
type(B), pointer::res
res => typeA%ptrB
end function GetPtrB
end module typeAmodule
module typeCclass
use typeAmodule
implicit none
private
public :: C
type, extends(anotherClass)::C
type(A), pointer::ptrA
contains
procedure, public, pass :: GetB
end typeC
contains
function GetB(typC) result(res)
class(C), intent(in)::typC
type(B), pointer::res
res => GetPtrB(typC%ptrA)
end function GetB
end module typeCclass
program SomeProgram
include typeCclass
implicit none
type(C)::typC
type(B), pointer::ptrB
...
...
ptrB => typC%GetB() !<<----
end program SomeProgram[/plain]
The compiling error I get is "error #6678: When the target is an expression it must deliver a pointer result." at the line marked with the '!<<----'. What I don't understand is the function 'GetB' is returning a pointer result, 'type(B), pointer', and is almost exactly like the function 'GetPtrB' except it is defined in the class, not as a subroutine accessing data in a type. I have done some research online, and as far as I can tell, I am using the function correctly. Any help is greatly appreciated, and please ask any questions if you need more clarification.
Link Copied
14 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please post a compilable example. Your paraphrase here has too many errors and missing declarations. ("return" instead of "result", "include" instead of "use", no declaration for B, etc.) It is impossible to tell what the real problem is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Please post a compilable example. Your paraphrase here has too many errors and missing declarations. ("return" instead of "result", "include" instead of "use", no declaration for B, etc.) It is impossible to tell what the real problem is.
Sorry for the bad, quick programming. Here is a (non)compilable program that reproduces the result. As you can see the function GetCA returns a pointer, but the compiler throws an error saying it doesn't. I'm sure I'm not programming correctly, but after researching this problem on the internet for a few days, I am at my wits end as to what error I am doing. I'm grateful for any help you can provide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. I agree that the error seems suspect. I'll run this by the developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Ok. I agree that the error seems suspect. I'll run this by the developers.
I'm sorry for my ignorance, but what happens now? Do I wait for a replay to this thread, or just wait for it to be address on next release?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will update this thread as I learn more. Perhaps I'll find a workaround. If it is really a bug, it will be fixed in a future update and I'll say so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
I will update this thread as I learn more. Perhaps I'll find a workaround. If it is really a bug, it will be fixed in a future update and I'll say so.
For anyone else who runs into this problem, a workaround, albiet a bad one, is to declare the variable in ClassC public and call the access routines in TypeB directly.
use TypeBModule
ptrA => GetAB(classC%ptrB)
instead of
ptrA => classC%GetCA()
However, this is not the way it should be done because it changes variable in the C class to public, ruining the encapsulation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our issue ID is DPD200148269.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Our issue ID is DPD200148269.
Hey Steve,
Thanks for your timely response on this. At least now I know I'm not going crazy. is there anything I should do with that issue ID to track this bug or continue to sit and wait. I am also running into similar problems with procedure calls inside of a class (though I can't reproduce this bug at this time, i.e. haven't tried yet).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's nothing else you need do - I'll track the issue and update this thread when there is news. If you find other issues, please let us know.
Update 4 is coming out in the next week or so - the issue you reported here isn't fixed in that.
Update 4 is coming out in the next week or so - the issue you reported here isn't fixed in that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
There's nothing else you need do - I'll track the issue and update this thread when there is news. If you find other issues, please let us know.
Update 4 is coming out in the next week or so - the issue you reported here isn't fixed in that.
Update 4 is coming out in the next week or so - the issue you reported here isn't fixed in that.
I am trying to reproduce the 2 or 3 other bugs but, as you can image, it's difficult. It throws an error in my code, but when I try to reproduce it in the demo code, it works fine. sigh... I'll try to get it to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - lopes8070
I am trying to reproduce the 2 or 3 other bugs but, as you can image, it's difficult. It throws an error in my code, but when I try to reproduce it in the demo code, it works fine. sigh... I'll try to get it to work.
I am also running into this message a lot:
: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
as well as,
: error #6618: The INTERFACE/CONTAINS stack is full. This means that modules are being 'used' in a circular way.
But I do not have any circular 'use' statements. I can honestly say, I have no clue what either of these mean. The first time I go the second error, I was able to avoid it by not using interfaces to class procedures, but now I am getting it no matter what (with no interfaces to class procedures). I have no work around as of yet, for the catastrophic error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The first is almost always a compiler bug. Please provide us a test case and tell us what switches you used.
The second might also be a compiler bug, but hard to say. Please provide us a test case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 6678 error is fixed, and the fix should appear in Update 6. The 6618 issue is being investigated as issue DPD200152345.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 6678 issue is fixed in Update 6, available now. The 6618 issue is not yet fixed.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page