- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Optional arguments that are also polymorphic seem to have runtime issues. The following inocuous example:
[fortran]MODULE MyChickenIsARooster
IMPLICIT NONE
TYPE :: Parent
INTEGER :: i
END TYPE Parent
CONTAINS
SUBROUTINE Level1(arg)
CLASS(Parent), INTENT(IN), OPTIONAL :: arg
CALL Level2(ARG=arg)
END SUBROUTINE Level1
SUBROUTINE Level2(arg)
CLASS(Parent), INTENT(IN), OPTIONAL :: arg
IF (PRESENT(arg)) THEN
PRINT *, 'Hello play :)'
ELSE
PRINT *, 'Hello work :('
END IF
END SUBROUTINE Level2
END MODULE MyChickenIsARooster
PROGRAM OptionallyPolymorphic
USE MyChickenIsARooster
IMPLICIT NONE
CALL Level1
END PROGRAM OptionallyPolymorphic
[/fortran] compiles ok, but explodes on execution:[plain]>ifort /check:all /warn:all /standard-semantics /stand:f03 /traceback /debug optionally_polymorphic.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.4.196 Build 20110427 Copyright (C) 1985-2011 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. -out:optionally_polymorphic.exe -debug -pdb:optionally_polymorphic.pdb -subsystem:console -incremental:no optionally_polymorphic.obj >optionally_polymorphic forrtl: severe (157): Program Exception - access violation Image PC Routine Line Source optionally_polymo 00401006 _MYCHICKENISAROOS 9 optionally_polymorphic.f90 optionally_polymo 0040113B _MAIN__ 25 optionally_polymorphic.f90 optionally_polymo 004786F3 Unknown Unknown Unknown optionally_polymo 0044DF0B Unknown Unknown Unknown kernel32.dll 7C817077 Unknown Unknown Unknown[/plain]
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Works without /check:all. Often, especially with sources that use bleeding edge language features, the /warn and /check options are unable to keep up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Seems to be /check:pointer that is the culprit here. I will let the developers know - thanks. Issue ID is DPD200170041.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed for an update later this year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is fixed in Update 7.
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