For the Intel Fortran integration in Photran, we would be okay with making ‘-check bounds’ enabled by default on debug configurations. It would not be appropriate to enable ‘-check all’ by default. Our Visual Fortran product enables ‘-check bounds’ for debug configs, so to do so on Photran would make us consistent too. Bill From: photran-bounces@xxxxxxxxxxx [mailto:photran-bounces@xxxxxxxxxxx] On Behalf Of Jeffrey Overbey Sent: Thursday, March 17, 2011 6:50 AM To: Photran Information Subject: Re: [photran] Request for adding -fcheck=all to the default GCC Debug config I suggest adding -fcheck=all to the default GCC Debug config (or at least -fcheck=bounds),
Hmm... my version of gfortran (4.4.2) doesn't have an -fcheck=all, although there's an -fcheck-bounds options. Typically, a "debug configuration" would certainly have debug symbols enabled, and probably it would have assertions enabled. Fortran doesn't have assertions, but checking that array accesses are in bounds would be a typical one. So it makes sense to enable it. The problem is that it can be pretty expensive. At -O0 (no compiler optimizations), my toy Gaussian Elimination runs in 6.7 seconds without -fcheck-bounds, and 12.2 seconds with -fcheck-bounds. Now, it's debatable whether this speed difference matters in a debug configuration. But with that big of a performance hit, you could argue that it should be disabled by default and only enabled if the user explicitly decides to make that safety/performance trade-off. I guess my point is that you can make a solid argument for adding -fcheck-bounds to the defaults, and you can make a solid argument against it. What do others think? |