Problem 1263 - CMAKE Build with -g and FPE but without -O2
Summary: CMAKE Build with -g and FPE but without -O2
Status: CLOSED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: cmake (show other problems)
Version: other
Hardware: All All
: P5 trivial
Assignee: Ben Morgan
URL:
Depends on:
Blocks:
 
Reported: 2011-11-24 12:17 CET by Andrea Dotti
Modified: 2012-11-13 15:21 CET (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Andrea Dotti 2011-11-24 12:17:29 CET
Hello,
in candidate tag for 9.5 there is not the possibility to setup a build with cmake (except using direct command line parameters to CMAKE) to have a build with debug symbols and FPE check without optimization.

This cause problems during validation, since, while the complete stack trace is present, values of variables are optimized out and debug is made much more harder.

For developers, testers and for people doing release validation it is required a build type that does not contain any optimization. Validation is performed on linux, thus if this combination is not possible on all platforms we need it at least on linux.

I propose to have TestReleaseDebug build type with the following options:
   -g -DG4DEBUG_VERBOSE -DG4FPE_DEBUG

Thank you,
   Andrea
Comment 1 Ben Morgan 2011-12-06 19:56:45 CET
This is not a problem to fix, but I need an absolutely clear statement of the flags that are needed, and their platform and compiler dependencies.

To clarify what is done in 9.5, for the GNU C++ compiler, we create a mode 'TestRelease'. This has flags (in addition to the core Geant4 flags):

Non-Apple: -O2 -g -G4DEBUG_VERBOSE -G4FPE_DEBUG
Apple    : -g -G4DEBUG_VERBOSE -G4FPE_DEBUG

With MSVC, the additional flags are

-O2 -Zi -G4DEBUG_VERBOSE

With Intel compilers, the additional flags are

-O2 -g -G4DEBUG_VERBOSE


From the description, it sounds like this mode is really used to validate, so perhaps 'Validation' would be a better name for the mode?

Is optimization always/never/sometimes needed?

There's no technical issue in fixing this other than having a clear and agreed definition of the required flags, and avoiding too many different modes.

Cheers,

Ben.
Comment 2 Ben Morgan 2012-09-07 17:18:01 CEST
Is this bug still valid, and if so, please review Comment #1 and reply.
Comment 3 Andrea Dotti 2012-09-07 17:27:21 CEST
Hi.
An important use case for "TestRelease" is the use for Validation. In particular my concern is on the non-Apple (i.e. Linux) -O2 option, that makes more difficult debugging in case of problems. 

I thus propose to drop the -O2.
If it helps to reduce confusion, I agree on changing the name of the following combination of options (on all possible platforms that support it, with priority to LINUX):
-DG4FPE_DEBUG -g -DG4DEBUG_VERBOSE

A name like "Validation" is adequate
Comment 4 Ben Morgan 2012-09-14 16:05:15 CEST
Thanks Andrea! I will update when there is a tag in place to implement this (likely next few weeks)
Comment 5 Ben Morgan 2012-09-19 13:57:52 CEST
I've just proposed tag cmake-V09-05-44:

"""
Remove optimization in TestRelease mode (Bug #1263)

Build TestRelease mode without optimization on all platforms currently
supporting this mode. Remove obsolete TestReleaseDebug build mode
as new TestRelease mode fully supports debug.
"""

The TestRelease mode should now be consistent - please let me know if this is o.k., and we can close the bug.

Cheers,

Ben.
Comment 6 Ben Morgan 2012-11-13 15:21:35 CET
Marking this as fixed, please reopen if there are still issues.