Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--with-pydebug builds now include -O2 by default #52871

Closed
mdickinson opened this issue May 5, 2010 · 6 comments
Closed

--with-pydebug builds now include -O2 by default #52871

mdickinson opened this issue May 5, 2010 · 6 comments
Assignees
Labels
build The build process and cross-build type-bug An unexpected behavior, bug, or error

Comments

@mdickinson
Copy link
Member

BPO 8625
Nosy @malemburg, @mdickinson, @pitrou, @vstinner
Files
  • no_debug_optimization.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/mdickinson'
    closed_at = <Date 2010-05-05.22:33:53.613>
    created_at = <Date 2010-05-05.14:03:48.464>
    labels = ['type-bug', 'build']
    title = '--with-pydebug builds now include -O2 by default'
    updated_at = <Date 2010-05-06.00:31:46.107>
    user = 'https://github.com/mdickinson'

    bugs.python.org fields:

    activity = <Date 2010-05-06.00:31:46.107>
    actor = 'vstinner'
    assignee = 'mark.dickinson'
    closed = True
    closed_date = <Date 2010-05-05.22:33:53.613>
    closer = 'mark.dickinson'
    components = ['Build']
    creation = <Date 2010-05-05.14:03:48.464>
    creator = 'mark.dickinson'
    dependencies = []
    files = ['17219']
    hgrepos = []
    issue_num = 8625
    keywords = ['patch']
    message_count = 6.0
    messages = ['105035', '105037', '105038', '105049', '105103', '105114']
    nosy_count = 5.0
    nosy_names = ['lemburg', 'mark.dickinson', 'pitrou', 'vstinner', 'Arfrever']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue8625'
    versions = ['Python 2.7', 'Python 3.2']

    @mdickinson
    Copy link
    Member Author

    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?

    @mdickinson mdickinson added build The build process and cross-build type-bug An unexpected behavior, bug, or error labels May 5, 2010
    @mdickinson
    Copy link
    Member Author

    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."""

    @pitrou
    Copy link
    Member

    pitrou commented May 5, 2010

    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.

    @malemburg
    Copy link
    Member

    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.

    @mdickinson
    Copy link
    Member Author

    Applied in r80832 (trunk), r80834 (py3k). Thanks, all.

    @mdickinson mdickinson self-assigned this May 5, 2010
    @vstinner
    Copy link
    Member

    vstinner commented May 6, 2010

    Thanks!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants