Skip to content

Commit

Permalink
Fix disabling optimizations with CLING_DEBUG
Browse files Browse the repository at this point in the history
As noted in #14593, the build fails during a rootcling execution when
setting CLING_DEBUG=1 in the environment with
error: invalid integral value '0 -fno-omit-frame-pointer' in '-O0 -fno-omit-frame-pointer'

Upon investigation, it only works in the ROOT prompt because TCling
turns on basic -O1 unless in rootcling. This overrides the (misformed)
"-O0 -fno-omit-frame-pointer". Split the argument in two entries and
move it after inserting the user-provided arguments to properly apply
also on the prompt by now taking precedence over -O1.

Closes #14593
  • Loading branch information
hahnjo authored and jenkins committed Feb 14, 2024
1 parent 45d9a08 commit fa648e8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/Interpreter/CIFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,18 +1342,21 @@ namespace {
if(COpts.CUDAHost)
argvCompile.push_back("--cuda-host-only");

// argv[0] already inserted, get the rest
argvCompile.insert(argvCompile.end(), argv+1, argv + argc);

#ifdef __linux__
// Keep frame pointer to make JIT stack unwinding reliable for profiling
if (profilingEnabled)
argvCompile.push_back("-fno-omit-frame-pointer");
#endif

// Disable optimizations and keep frame pointer when debugging
if (debuggingEnabled)
argvCompile.push_back("-O0 -fno-omit-frame-pointer");

// argv[0] already inserted, get the rest
argvCompile.insert(argvCompile.end(), argv+1, argv + argc);
// Disable optimizations and keep frame pointer when debugging, overriding
// other optimization options that might be in argv
if (debuggingEnabled) {
argvCompile.push_back("-O0");
argvCompile.push_back("-fno-omit-frame-pointer");
}

// Add host specific includes, -resource-dir if necessary, and -isysroot
std::string ClingBin = GetExecutablePath(argv[0]);
Expand Down

0 comments on commit fa648e8

Please sign in to comment.