What flags do you set for your GFORTRAN debugger/compiler to catch faulty code?

后端 未结 2 1621
遇见更好的自我
遇见更好的自我 2020-12-07 10:14

I think I won\'t find that in any textbook, because answering this takes experience. I am currently in the stage of testing/validating my code / hunting bugs to get it into

2条回答
  •  抹茶落季
    2020-12-07 10:37

    For debugging I use: -O2 -fimplicit-none -Wall -Wline-truncation -Wcharacter-truncation -Wsurprising -Waliasing -Wimplicit-interface -Wunused-parameter -fwhole-file -fcheck=all -std=f2008 -pedantic -fbacktrace. For ones not already explained, check the gfortran manual. -fcheck=all includes -fcheck=bounds.

    For production I use: -O3 -march=native -fimplicit-none -Wall -Wline-truncation -fwhole-file -std=f2008. Runtime checks such as bounds checking increase the execution time of the resulting executable. I've found the cost to frequently be surprisingly low, but it can be high. Hence no runtime checks on compiles for production.

提交回复
热议问题