Skip to content

Fix mingw bare -O optimization flag under -m32 #5265

Description

@jaraco

Part of the compilers decoupling epic #5264 (Phase 1).

The mingw compiler injects a bare -O optimization flag. cc1 accepts this for 64-bit builds, but under -m32 it rejects it:

cc1.exe: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'

(reported in #4873)

Fix: in distutils/compilers/C/cygwin.py, normalize the bare -O to -O1 (or suppress it when a numbered -O is already present in the flags). Add a regression test and a newsfragment. Ships independently of the rest of Phase 1 — good warm-up.

Closes #4873.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions