Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 410089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:51:16+00:00 2026-05-12T17:51:16+00:00

When writing and calling pure subroutines in Fortran 90 using gfortran, how do I

  • 0

When writing and calling pure subroutines in Fortran 90 using gfortran, how do I find out why the compiler emits this error?

Error: Subroutine call to XXXX at (1) is not PURE

I’ll try to pose my question as specifically as I can while at the same time being general enough to be useful to others, so I’ll avoid pasting in my actual code and instead will sketch what happened.

I understand there are various rules about pure procedures in Fortran 90, which I think basically boil down to not permitting side-effects in either functions or subroutines, and not permitting changes to subroutine parameters declared with intent(in). I’ve a series of subroutines which initially were not declared to be pure, and whose parameters didn’t have declared intent, but which nevertheless didn’t perform side-effects. First, I changed all parameter declarations to have explicitly-declared intent, either in, out, or inout. Then, I declared all the subroutines to be PURE. Naturally, many errors occurred on the first attempt, but the compiler told me what the errors were (such-and-such parameter with intent(in) is being modified, for example), so one-by-one I fixed them all.

There are calls among these procedures, however, and so now I still get many errors of the form shown above: Subroutine call to XXXX at (1) is not PURE. What I don’t understand is why the call is not pure. I’ve done everything I can think of to make XXXX pure, but the compiler still thinks it isn’t.

So my question –rephrased– is: how do I get gfortran to tell me WHY it thinks XXXX is not pure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:51:16+00:00Added an answer on May 12, 2026 at 5:51 pm

    “Placed all the PURE subroutines in the library I’m working on, into a MODULE (which my client code then USEd). …… Not sure why ….., but after doing this more useful error messages appeared which allowed me to track down the remaining impurities.”

    Placing the subroutines into a module and then using them makes the interface explicit. This allows the compiler to check agreement between the call and the subroutine and generate error messages if there is a discrepancy. Very useful, so placing subroutines and functions into modules good practice.

    The other way of making an interface explicit is to write an interface, but that is extra work and an extra step to get wrong.

    There is a long list of requirements on pure subroutines/functions. If you have Fortran 95/2003 Explained by Metcalf, Reid and Cohen, see section 6.10. For example, no “save” variables, no stop statement, no IO on external file, …

    You can also try other compilers to see if their error message is more helpful. Other free ones, depending on OS, include g95 and Sun Studio.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a python program, and I came up with this error while using the
I'm writing this bookmarklet in Javascript, which is also calling some JQuery objects. The
How do you go about writing out HTML to the calling position of a
I'm new to JS and am writing a notification plug-in. Currently I'm calling this
I am writing a bash script that uses calling syntax script [options] [dir] To
I'm writing an app that is calling a server to get data to show
I am writing some tools for our build system to enforce some strict calling
I am writing a usenet newsreader, and calling the XOVER id- message to get
It's a bit tedious writing the whole path to the Entity when calling getRepository()
I'm writing a web application in which i use several thirdy party commands calling

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.