From f67b67e7cb877d17beb640ef897edc78805fd2bb Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Tue, 28 Jul 2020 15:52:44 -0400 Subject: [PATCH 1/2] Fixes #227 - WSL issue Under WSL, GFortran-9 would crash immediately when runing some tests. Exact cause has not been determined, but raising the optimization level avoids the problem. GFortran-10 appears to not have the issue. --- ChangeLog.md | 4 ++++ cmake/GNU.cmake | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 68d1be60..6c980b7c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +### Fixed + +- Fixed problem under WSL+Gfortran-9 in which -O0 crashed pFUnit self tests. ## [4.1.9] - 2020-05-29 diff --git a/cmake/GNU.cmake b/cmake/GNU.cmake index 049e0a53..cc2d28a2 100644 --- a/cmake/GNU.cmake +++ b/cmake/GNU.cmake @@ -4,11 +4,13 @@ set(traceback "-fbacktrace") set(check_all "-fbounds-check") set(cpp "-cpp") +string(REGEX MATCH "Microsoft" WSL ${CMAKE_HOST_SYSTEM_VERSION}) +if (WSL AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10) + set(opt "-O2") +else () + set(opt "-O0") +endif () -set(CMAKE_Fortran_FLAGS_DEBUG "-O0") -set(CMAKE_Fortran_FLAGS_RELEASE "-O3") -#set(CMAKE_Fortran_FLAGS "-g ${cpp} -O0 ${traceback} ${check_all} -ffree-line-length-512") -set(CMAKE_Fortran_FLAGS "-g ${cpp} -O0 ${traceback} -ffree-line-length-512") - +set(CMAKE_Fortran_FLAGS "-g ${cpp} ${opt} ${traceback} -ffree-line-length-512") add_definitions(-D_GNU) From c3781c8015c8280a289a1cd64fbaa1965d025ce5 Mon Sep 17 00:00:00 2001 From: Tom Clune Date: Tue, 28 Jul 2020 16:31:18 -0400 Subject: [PATCH 2/2] Update GNU.cmake --- cmake/GNU.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/GNU.cmake b/cmake/GNU.cmake index cc2d28a2..c3fe51bd 100644 --- a/cmake/GNU.cmake +++ b/cmake/GNU.cmake @@ -5,7 +5,7 @@ set(check_all "-fbounds-check") set(cpp "-cpp") string(REGEX MATCH "Microsoft" WSL ${CMAKE_HOST_SYSTEM_VERSION}) -if (WSL AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 10) +if (WSL) set(opt "-O2") else () set(opt "-O0")