# Tool to mark procedures as PURE or ELEMENTAL and add argument INTENTs

**URL:** <https://fortran-lang.discourse.group/t/tool-to-mark-procedures-as-pure-or-elemental-and-add-argument-intents/10692>\
**Category:** Announcements\
**Created:** [February 3, 2026, 6:33pm UTC](https://fortran-lang.discourse.group/t/tool-to-mark-procedures-as-pure-or-elemental-and-add-argument-intents/10692 "2026-02-03T18:33:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 3, 2026, 6:33pm UTC](https://fortran-lang.discourse.group/t/tool-to-mark-procedures-as-pure-or-elemental-and-add-argument-intents/10692/1 "2026-02-03T18:33:50Z")

</div>

> **[GitHub - Beliavsky/Pure-Fortran: Python scripts to mark Fortran procedures as pure...](https://github.com/Beliavsky/Pure-Fortran)**
>
> Python scripts to mark Fortran procedures as pure or elemental, add argument intents, and make other changes

is a set of Python scripts to mark Fortran procedures as `pure` or `elemental`, add argument `intent`s, and declare module procedures, constants, and variables as `private` when possible. The scripts test that the code still compiles after the changes. @rouson has advised that procedures should be pure.

---

<div class="post-metadata">

**Author:** ![nja](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nja](https://fortran-lang.discourse.group/u/nja)\
**Post date:** [February 19, 2026, 12:48pm UTC](https://fortran-lang.discourse.group/t/tool-to-mark-procedures-as-pure-or-elemental-and-add-argument-intents/10692/2 "2026-02-19T12:48:51Z")

</div>

I have a question: I notice the tool skips procedures defined in `interface` blocks:

```fortran
subroutine test1(a)
  integer, intent(in), value :: a
end subroutine

subroutine test2(a)
  integer, intent(in), optional :: a
end subroutine

interface
  module subroutine test3(a)
    integer, intent(in), value :: a
  end subroutine
end interface

subroutine test4(a)
  integer, intent(in), value :: a
end subroutine

```

Then `python xpure.py a.f90 --verbose` show:

```auto
3 Likely PURE candidates (not currently marked pure/elemental):
  - subroutine test1 [lines 1-3]
  - subroutine test2 [lines 5-7]
  - subroutine test4 [lines 15-17]

```

`test3` is ignored here. Is it because the tools analyzes the contents of the function (calls, etc.), not only its arguments?

---

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 19, 2026, 4:11pm UTC](https://fortran-lang.discourse.group/t/tool-to-mark-procedures-as-pure-or-elemental-and-add-argument-intents/10692/3 "2026-02-19T16:11:45Z")

</div>

It does look at the body of a procedure to determine if it can be `pure`. For example, inserting `print*,a` in `test1` causes it to no longer be a candidate for `pure`.

---

<div class="post-metadata">

**Author:** ![nja](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nja](https://fortran-lang.discourse.group/u/nja)\
**Post date:** [February 19, 2026, 5:48pm UTC](https://fortran-lang.discourse.group/t/tool-to-mark-procedures-as-pure-or-elemental-and-add-argument-intents/10692/4 "2026-02-19T17:48:52Z")

</div>

Thank you. I was about to suggest to process interfaces for `bind(c)` procedures (I think they can be marked `pure` as well, and should be in order to be called by pure Fortran procedures), checking the arguments only. But on second thought this looks too dangerous.
