Skip to content

Commit a8f7ff2

Browse files
committed
warn on realloc GCC
1 parent 2c829dd commit a8f7ff2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.15) # implicit CMP0094
22

33
if(NOT CMAKE_BUILD_TYPE)
4-
set(CMAKE_BUILD_TYPE Release CACHE STRING "default build type")
4+
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "default build type")
55
endif()
66

77
project(Fortran2018Examples

cmake/compilers.cmake

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,22 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
2525
add_compile_options(/arch:native)
2626
string(APPEND CMAKE_Fortran_FLAGS " /traceback /warn /heap-arrays")
2727
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " /stand:f18")
28-
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " /debug /check:all")
28+
string(APPEND CMAKE_Fortran_FLAGS " /debug /check:all")
2929
else()
3030
add_compile_options(-march=native)
3131
string(APPEND CMAKE_Fortran_FLAGS " -traceback -warn -heap-arrays")
3232
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -stand f18")
33-
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -debug extended -check all")
33+
string(APPEND CMAKE_Fortran_FLAGS " -debug extended -check all")
3434
endif()
3535
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
3636
add_compile_options(-mtune=native -Wall)
3737
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 8)
3838
string(APPEND CMAKE_Fortran_FLAGS " -std=f2018")
3939
endif()
40-
if(CMAKE_Fortran_COMPILER_VERSION VERSION_EQUAL 9.3.0)
41-
string(APPEND CMAKE_Fortran_FLAGS " -Wno-maybe-uninitialized")
42-
endif()
43-
string(APPEND CMAKE_Fortran_FLAGS " -fimplicit-none")
4440

45-
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -Werror=array-bounds -fcheck=all")
41+
string(APPEND CMAKE_Fortran_FLAGS " -fimplicit-none")
42+
string(APPEND CMAKE_Fortran_FLAGS " -Wrealloc-lhs") # not -Wrealloc-lhs-all which warns on character
43+
string(APPEND CMAKE_Fortran_FLAGS " -Werror=array-bounds -fcheck=all")
4644
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL PGI)
4745
string(APPEND CMAKE_Fortran_FLAGS " -C -Mdclchk")
4846
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)

0 commit comments

Comments
 (0)