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

  • SEARCH
  • Home
  • 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 8829241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:47:26+00:00 2026-06-14T07:47:26+00:00

I have some legacy Fortran code which I’m recompiling using the latest Intel compiler

  • 0

I have some legacy Fortran code which I’m recompiling using the latest Intel compiler for Windows (that runs within Visual Studio). Sadly my Fortran skills are more than a little rusty.

This particular code makes use of an array to note any problems that occur during the program’s execution. This array is declared thus:

CHARACTER FAIL(25)*(255)

Here’s a piece of code that checks this array and does something if it finds an element beginning with 'F' (ie ‘failed’)

      DO 20 CNTERR = OERRNO,ERRNO
         IF (FAIL(CNTERR)(1:1).EQ.'F') GOTO 9999
   20 CONTINUE

In almost all cases OERRNO and ERRNO are zero, and thus CNTERR will also be zero. Which means, I think, that – as Fortran uses 1-based arrays – I’m looking at an element which doesn’t exist.

The code will compile and run without any problems using the default ‘Release’ Configuration within VS. It will compile but fail to run with the default ‘Debug’ Configuration. The important difference, I think, is that ‘Debug’ has the ‘Check Array and String Bounds’ option set ie /check:bounds.

My question: The code appears to run correctly if built with the ‘Release’ configuration. But am I doing a seriously Bad Thing that will bite me? What does Fortran return when you ask for an out-of-bounds array element?

  • 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-14T07:47:27+00:00Added an answer on June 14, 2026 at 7:47 am

    My question: The code appears to run correctly if built with the
    ‘Release’ configuration. But am I doing a seriously Bad Thing that
    will bite me? What does FORTRAN return when you ask for an
    out-of-bounds array element?

    You are right. Accessing out of bounds is always wrong, and yes it could easily bite you. As to what Fortran says will happen? Well it merely says you can’t do it, and in such cases the implementation can do anything it likes, from nothing, to outputting a useful error message, to sounding the 3 minute warning.

    To fix it we need more code, but I suspect initialising OERRNO to 1 will do it, as then in the case ERRNO=0 the loop will not be executed.

    One other thing:

    CHARACTER FAIL(25)*(255)

    My F77 is rusty, F90 style is different here, but I’m not sure this is right. My failing memory suggests

    CHARACTER*255 FAIL(25)
    

    instead.

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

Sidebar

Related Questions

I have some old (~1995) legacy fortran code which is compiled with g77 compiler
We have some legacy code that needs to identify in the Page_Load which event
I have some legacy code that I'm rewriting using SubSonic to help the future
I have some legacy python code that using pypar and mpich2 to transmit data
We have some legacy ASP.NET code that detects if a request is secure, and
I have some legacy code that was used to monitor my applications cpu,memory etc
I have some legacy C++ code that I am trying to understand a bit
I need to integrate some legacy 32-bit code - for which I don't have
I have some legacy code that uses Interlocked.Equals to compare values. The values may
Currently I have some legacy ASP.NET 2.0 code that uses the ASP Xml web

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.