I’m trying to get some legacy code to not crash and burn with the PGI compiler, and I came across a stack overflow post (edit: this one) that recommended a so-called “maximum debug” collection of compiler options for gfortran:
-O2 -fimplicit-none -Wall -Wline-truncation -Wcharacter-truncation -Wsurprising -Waliasing -Wimplicit-interface -Wunused-parameter -fwhole-file -fcheck=all -fbacktrace
What are the PGI equivalents to most of these?
- -O2: -O2
- -fimplicit-none: -Mdclchk?
- -Wall: -Minform=inform? The gfortran compiler seems to have a lot more specific things it can warn about than the PGI compiler, such as…
- -Wline-truncation, -Waliasing, -Wimplicit-interface, -Wunused-parameter: ??
- -fwhole-file: ??
- -fcheck=all: -Mbounds? (Which is itself equivalent to -C, right?)
- -fbacktrace: -traceback
I’m already using the PGI-specific flag -Ktrap=fp,unf in my quest to get this code working. Are there any other flags you would suggest for maximum debugging?
While I have you, I’m having trouble getting -traceback to actually give a line number. I have to be using the PGI debugger in order to get the proper trace, which is a bit surprising to me (I am compiling with -g if that makes a difference). Is there a way to have the program write the trace to the display unit? Thanks in advance for the help.