- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear,
a probable bug in ifx: in the following example, a pure internal procedure modifies a variable of its parent subroutine.
ifx fails to report this side effect (see also the discussion at https://fortran-lang.discourse.group/t/internal-pure-procedure-with-side-effect/8974).
Thank you.
module foo_m
implicit none
contains
subroutine foo ( a, b )
integer, intent(in out) :: a, b
b = 0
call sbar ( a )
b = fbar ( a )
contains
pure subroutine sbar ( a )
integer, intent(out) :: a
a = b
b = 1 ! <- the compiler should report this error
end subroutine sbar
pure function fbar ( a ) result( r )
integer, intent(in) :: a
integer :: r
r = a+b
b = 2 ! <- same here
end function fbar
end subroutine foo
end module foo_m
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@riad_h_1
thanks for reporting that, I agree that should not happen. I escalated this to our dev team

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