compiler options question

I am compiling some old code with pgf77, and was wondering what some of the compiler options in the makefile were.

Specifically, what does:
-My,120,0x20
-Mx,120,0x20

do? pgf77 -help says “pass x flag to compiler”, but I don’t know what that means.

Also, is there a compiler flag to control whether data is initialized to zero? Is this done automatically?

Thanks

Hi,

What application is this? We normally don’t export x flag to user because an x flag in one release might give the opposite effect on another release.

It looks like it has something to do with generating debugging information.

Hongyon

It’s a scientific computing application. It’s pretty old so I’m not sure what version of pgi it’s programmers were using when they wrote it, probably 3.something.

I’m just wondering if it’s safe to discard them, sounds like it is.

Also, is there a flag to initialize memory to a specific value or zero (like gfortran’s -finit-local-zero)? I think this code was programmed with that assumption.

Hi eqhq,

Yes, please discard the -Mx/-My flags. “xflags” are used internally by the compiler and in general should not be used by user.

While we do not have and equivalent “-finit-local-zero”, the flag “-Msave”, which treats all local variables as having the SAVE attribute, has the side effect of initializing local variables to zero when the program is loaded. Note that with SAVE, a variable will retain it’s value from the last call to the subroutine and is not re-initialized each time the subroutine is called.

As an aside, you might want to consider updating your code to initialize your local variables. If it’s a large application, a utility like Valgrind (www.valgrind.org) can be very helpful in finding uninitialized memory reads (UMRs) which is generally the reason users request a flag like “-finit-local-zero”.

Hope this helps,
Mat

Wow, that is a pretty sweet application. It would have been really helpful last week when I was trying to find all the incorrectly sized memory pointers :).

Thanks for the tip.