Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How about a warning??

Andrea_B_
Beginner
3,938 Views

How is it even possible?? Yesterday I had nothing to do at work, so I decided to move the entire project from VS 2008 Pro + IVF10 to Code::Blocks 12.11 with gfortran 4.7 or something, just to play with new tools and pass some time. I was shocked to find that gfortran found THOUSANDS of errors, either real compiler errors or simple warnings that are simple warnings because of Fortran's archaic rules but are actually subtle bugs which I would NEVER find using IVF. One example above all (please disregard the code itself, it's legacy and horrible and I didn't even read it):

Not even a warning? What is ''C ?? Ok, let's see gfortran:

How could this slip through? I compiled with IVF using -Wall (or its equivalent)!!!

Pls don't say "it's the old version, IVF Composer 2013 works fine", this product was paid for and 2008 is just a few years ago!!

Other examples of mistakes not caught:

FORMAT('Error at line number ', I) instead of FORMAT('Error at line number ', I3)

gfortran's message: "error: you must give a non-null width for the number in the format statement" (or something like that)!! There were hundreds of these typos, and not a single word from IVF!

And above all: not a single warning about the use of uninitialized variables! How many times have I had to debug at runtime this (awful) legacy code because a parameter was moved from an include file to another, leaving an implicitly decleared variable uninitialized in every subroutine that includes the old include file?? Wow...really shocked.

Am I missing anything? Because I used the option to warn for everything...but the best it can do is warn against implicitly declared variables, HOW USEFUL!

0 Kudos
30 Replies
Andrea_B_
Beginner
1,209 Views

Steve Lionel (Intel) wrote:

Andrea, would you please attach a zip of the buildlog.htm after a rebuild of both projects? The project files look fine to me - both have the option enabled. It could simply be an order of compilation issue.

Sure, but let me know if any sensible info about my code may contained in that file. If so, I'll send you the file privetely, otherwise I'll just attach it here.

Thanks.

0 Kudos
Steven_L_Intel1
Employee
1,209 Views

There's nothing about your code in the build log other than the names of the source files, unless there are error messages that quote source lines. You're welcome to send it to me privately if that's a concern.

0 Kudos
Andrea_B_
Beginner
1,209 Views

Actually, there's still a lot to clean up in CleanGS, stuff that gfortran didn't catch because despite many advantages over IVF, there's no option to check routine interfaces :) so I am not able yet to compile the project with this option turned on. I am starting to doubt I will ever be because there are so many mistakes, or simple bad parts of code, in this awful spaghetti code...

If I make it, I'll finally post the two buildlog files. Fingers crossed.

0 Kudos
Andrea_B_
Beginner
1,209 Views

Steve Lionel (Intel) wrote:

There's nothing about your code in the build log other than the names of the source files, unless there are error messages that quote source lines. You're welcome to send it to me privately if that's a concern.

Edit: will put the correct ones shortly.

0 Kudos
Andrea_B_
Beginner
1,209 Views

Steve Lionel (Intel) wrote:

There's nothing about your code in the build log other than the names of the source files, unless there are error messages that quote source lines. You're welcome to send it to me privately if that's a concern.

Here it is. Note the link error at the end of GS build, it is resolved just by launching the program with F5. No clue why.

Edit: found out why it wasn't working: /gen-interfaces must be on for /warn:interfaces to work...is this how it's supposed to work (common sense would suggest so)?

0 Kudos
Steven_L_Intel1
Employee
1,209 Views

I had not realized you were using compiler version 10.1!  I see now you said that in the original post but I missed it. Yes, in that version you need both /gen-interface and /warn:interface to get the warnings. In more recent versions (11.1 and later, I think), /warn:interface implies /gen-interface so you don't need the latter.

Why are you using a compiler from more than four years ago?

0 Kudos
Andrea_B_
Beginner
1,209 Views

Steve Lionel (Intel) wrote:

I had not realized you were using compiler version 10.1!  I see now you said that in the original post but I missed it. Yes, in that version you need both /gen-interface and /warn:interface to get the warnings. In more recent versions (11.1 and later, I think), /warn:interface implies /gen-interface so you don't need the latter.

Why are you using a compiler from more than four years ago?

Because this is what they have here, simple! And after all, I'm using a compiler from 5 years ago for a language from 36 years ago, I think it's still fair ;)

Thanks for the time, as always you're extremely helpful :)

Andrea

0 Kudos
dboggs
New Contributor I
1,209 Views

I don't think it is fair to describe this as "a language from 36 years ago." In some circles, the need for language evolution is accomplished by abandoning old languages and inventing new ones, resulting in the hundreds of possibilities we have today. In the Fortran community it is realized by advancing the language in a very methodical and controlled with great concern for backwards compatibility and longevity. I prever the latter approach.

0 Kudos
John_Campbell
New Contributor II
1,209 Views

Steve Lionel (Intel) wrote:

I by itself has an implied width based on the kind (size) of the integer value (7, 12 or 23). Fortran 2008 adds I0 which uses the minimum width needed to represent the value - that's nice to use.

Steve,

I was reading back through your posts on this topic. I am not familiar with the "I" format. When was this introduced? Has Fortran 2008 modified the way I0 was defined in Fortran 90.
I wish there was an option for I0(+1) to provide a leading space. Has this been introduced in 03 or 08 ?
I also find there is a some variability between compilers in the precision provided by *) format, so does the recent standard provide more precision definition for the "I" (or "F" if it exists) format ?

John

0 Kudos
Steven_L_Intel1
Employee
1,209 Views

I without a width is non-standard. It is an extension which dates back to DEC compilers in the early 1970s (pre-F77) and is sort of a poor-man's substitute for list-directed I/O. There are default widths for other data types supported - see the documentation - but I don't recommend using these in new code.

I0 has not changed in meaning since it was introduced. But since it always provides minimum width with no blanks, you can always put in the leading blank yourself with 1X.

Variability with list-directed formatting is exactly the way the standard defines it. Indeed, the standard has given implementations even more latitude in recent releases, such as allowing use of G0 (we now do this if /standard-semantics is enabled.)

0 Kudos
Reply