detecting assignment of uninitialized variables

Hi all -
Just finished tracking down an f90 problem that turned out to have an assignment of an uninitialized variable at its root. I’m used to SGI compilers where -DEBUG:trap_uninitialized=ON at least allows for quick checking for uninitialized floats and pointers. I haven’t been able to figure out an equivalent debugging switch for pgf90 - anyone have a quick way to trap on these errors?

Hi Gunther,

For pointers, pgf90 has a flag called “-Mchkptr” which will check if you are de-referencing a NULL pointer. “-Mbounds” will check for array out-of-bounds errors. However, there is not a flag to check for unitialized variables. Sorry.

  • Mat

Hi Gunther,

I was talking to our lead compiler architect about maybe adding something to the compiler to detect unitialized variables. He thinks it would be very useful so he’ll put it list of possible new features. We don’t know when it would make it into a release, however.


I agree that it would be very valuable to have a compiler switch to test for uninitialized variables. Two switches would be useful, one that traps uninitailzied variables, and one that initializes variables to zero.