open-catalog icon indicating copy to clipboard operation
open-catalog copied to clipboard

[Fortran] format strings may generate indistinguishable output

Open foxtran opened this issue 5 months ago • 1 comments

Format strings like '(5I0)' will generate single long number. Most of time, it is undesired behaviour.

Example:

program main
  print '(3I0)', [11, 22, 33]
  print '(3I0)', [112, 23, 3]
end program main

The same issue is for real type. For logical type, it is not a problem.

foxtran avatar Sep 11 '25 21:09 foxtran

Hi @foxtran,

I agree! That does look more like a typical source of errors rather than a behavior someone would usually leverage.

As usual, we'll keep this issue open to not lose track of the idea. And as always, feel free to open a PR if you'd like to suggest an entry for this potential check!

Steps for adding a new recommendation (click me)
  1. Each recommendation resides in its own directory under Checks/. Create the directory and update the list of checks in the README.md at the root of the repository.

  2. Add a README.md file that includes the following:

    • Title: ID (e.g., the next available PWR number) + Name of the recommendation.
    • Issue: A brief description (1-2 sentences) of how the discouraged practice impacts the code.
    • Actions: A brief explanation (1-2 sentences) of how to refactor the code from the discouraged to the encouraged practice.
    • Relevance: A more detailed explanation of why adopting the recommended practice is beneficial, expanding on the previous points.
    • Code examples: Include a before-and-after code example to illustrate the improvement.
    • References: Add links or references for further reading, if available.
  3. Create standalone example and solution source files containing the code examples.

  4. Optionally, include a benchmark demonstrating the before-and-after performance impact of the change. In cases like this, the expectation is that the performance of the code should not degrade.

For reference, feel free to check out previous PRs to see how these steps are implemented in practice. For example, this is the PR that added PWR075.

Naturally, don't hesitate to ask at any moment if you have any issues. We'll be glad to help!

alvrogd avatar Sep 12 '25 12:09 alvrogd