Issue 8625: --with-pydebug builds now include -O2 by default (original) (raw)

Issue8625

Created on 2010-05-05 14:03 by mark.dickinson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
no_debug_optimization.patch mark.dickinson,2010-05-05 14:03
Messages (6)
msg105035 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-05-05 14:03
When doing a debug build of Python with gcc, without any previous setting of CFLAGS, the '-O2' flag is now automatically included. This behaviour started in r79218. It would be nice to restore the original behaviour, if possible, since the optimization causes difficulties when debugging. One solution would be to add '-O0' to OPT for debug builds (on gcc), as in the attached patch. You then get compiler flags including: "-g -O2 -g -O0" which is somewhat ugly, but the -O0 overrides the -O2 (I think). Does this seem like a reasonable solution?
msg105037 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-05-05 14:08
Just double checked the gcc manual. From: http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html """If you use multiple -O options, with or without level numbers, the last such option is the one that is effective."""
msg105038 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-05-05 14:10
> It would be nice to restore the original behaviour, if possible, since > the optimization causes difficulties when debugging. One solution > would be to add '-O0' to OPT for debug builds (on gcc), as in the > attached patch. You then get compiler flags including: > > "-g -O2 -g -O0" > > which is somewhat ugly, but the -O0 overrides the -O2 (I think). Does > this seem like a reasonable solution? Probably good enough.
msg105049 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-05-05 15:27
Antoine Pitrou wrote: > > Antoine Pitrou <pitrou@free.fr> added the comment: > >> It would be nice to restore the original behaviour, if possible, since >> the optimization causes difficulties when debugging. One solution >> would be to add '-O0' to OPT for debug builds (on gcc), as in the >> attached patch. You then get compiler flags including: >> >> "-g -O2 -g -O0" >> >> which is somewhat ugly, but the -O0 overrides the -O2 (I think). Does >> this seem like a reasonable solution? > > Probably good enough. +1 OPT can also be overridden by the user, to e.g. actually get an optimized debug build in order to debug compiler optimization problems.
msg105103 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-05-05 22:33
Applied in r80832 (trunk), r80834 (py3k). Thanks, all.
msg105114 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-05-06 00:31
Thanks!
History
Date User Action Args
2022-04-11 14:57:00 admin set github: 52871
2010-05-06 00:31:46 vstinner set messages: +
2010-05-05 22:33:53 mark.dickinson set status: open -> closedassignee: mark.dickinsonresolution: fixedmessages: +
2010-05-05 15:27:23 lemburg set messages: +
2010-05-05 15:21:55 Arfrever set nosy: + Arfrever
2010-05-05 14:10:58 pitrou set messages: +
2010-05-05 14:08:30 mark.dickinson set messages: +
2010-05-05 14:03:48 mark.dickinson create