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 8625031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:40:51+00:00 2026-06-12T07:40:51+00:00

This question is connected to the problem: how to detect violation of intent(in) inside

  • 0

This question is connected to the problem: how to detect violation of intent(in) inside subprograms. But I haven’t found the answer in the related question Enforce intent(in) declared variables in Fortran as constant also in called subroutines/functions.

A variable which is declared as intent(in) can be modified by another subprogram/function with omitted intent declaration.

For example:

module test
  implicit none
  contains

  subroutine fun1(x)
    real(8), intent(in)::x
    call fun2(x)
  end subroutine

  subroutine fun2(x)
    real(8) :: x
    x = 10
  end subroutine
end module

This code can be compiled without any errors/warnings by gfortran and ifort. So my questions are:

  1. Is it possible to forbid omitting intent declaration?
  2. Is it possible to force a Fortran compiler to interpret omitted intent as intent(inout)?
  • 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-06-12T07:40:52+00:00Added an answer on June 12, 2026 at 7:40 am

    Both answers are NO. Unspecified intent is fundamentally different from all other intents. It is different from intent(inout), because you can pass a nondefinable expression to a subroutine with unspecified intent.

    Also in many contexts it is not allowed to specify intent at all (procedure arguments, pointers in Fortran 95,…)

    If you want to require specifying of intent, you may define your subroutine as pure but it does much more than that. But it may be the right thing for you. It forbids any side-effects.

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

Sidebar

Related Questions

This question is connected to my other question but I changed the logic a
I have read this question and found its answer to be useful to check
This question concerns a Tomcat 7 web application, which is connected to a MySQL
This is an interview question. I have K machines each of which is connected
This question is directly related to this SO question I posed about 15 minutes
This question is related to another question I wrote: Trouble using DOTNET from PHP.
In this question I was having problem with saving objects that had foreign keys
My problem is very similar to this question , however I am posting a
I've recently started tinkering with ASP.NET MVC, but this question should apply to classic
Firstly, this DB question could be a bit DB agnostic, but I am using

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.