# GNU: useful debug options
#
# You may use these debug options from your own configuration file like this:
#
# %include compilers/GNU-GCC_MPI
# %include compilers/extensions/GNU-GCC_debug

%section Makefile

	# switch off all optimizations and compile faster
	FFLAGS += -O0

	# turn on all warnings
	FFLAGS += -Wall
	# warn about array temporaries (for optimization)
	# FFLAGS += -Warray-temporaries

	# initialization of all floating point numbers with signalling NaN
	FFLAGS += -finit-real=sNaN
	# initialization of all integer numbers with -huge
	FFLAGS += -finit-integer=-2147483648

	# generate debugging information
	FFLAGS += -g
	# generate a traceback of function calls on crashes
	FFLAGS += -fbacktrace

	# allow all intrinsic functions (additional GCC-specific debugging)
	# FFLAGS += -fall-intrinsics

	# disallow any implicit typing
	FFLAGS += -fimplicit-none

	# check for implicit allocation of teporary memory for arguments
	# FFLAGS += -fcheck=array-temps
	# check for invalid array boundaries
	# FFLAGS += -fcheck=bounds
	# check for invalid pointers
	# FFLAGS += -fcheck=pointer
	# check for invalid modification of loop iterators
	# FFLAGS += -fcheck=do
	# check implicit memory allocations
	# FFLAGS += -fcheck=mem
	# check for unallowed recursions
	# FFLAGS += -fcheck=recursion

	# activate all of the above "-fcheck=..." checks at once
	FFLAGS += -fcheck=all

	# runtime checks for invalid arithmetics, division by zero, and overflow
	FFLAGS += -ffpe-trap=invalid,zero,overflow

%endsection Makefile