From ac305d3d84bd1e225c5fd3f6ddc908fcb26e17d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkovsky@mmg.fjfi.cvut.cz>
Date: Sat, 24 Aug 2019 13:52:52 +0200
Subject: [PATCH] Disabled link-time optimizations for Debug build with GCC

They lead to internal compiler error in some cases.
---
 CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f61021afd1..cc1be2d3fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,8 +105,10 @@ endif()
 # enable link time optimizations (but not in continuous integration)
 if( NOT DEFINED ENV{CI_JOB_NAME} )
    if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
-      add_compile_options( "-flto" )
-      add_link_options( "-flto" )
+      # LTO with GCC 9.1.0 and Debug build = internal compiler error
+      # LTO with GCC 9.1.0 and nvcc 10.1 and Release build = fatal error: bytecode stream in file `blabla` generated with LTO version 7.1 instead of the expected 8.0
+#      add_compile_options( "-flto" )
+#      add_link_options( "-flto" )
    elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
       add_compile_options( "-flto=thin" )
       add_link_options( "-flto=thin" )
-- 
GitLab