Skip to content

Spirit Classic Codegen Bug with GCC in Release Builds #737

@cmazakas

Description

@cmazakas

I've been working with @pdimov on some quickbook CI failures and I believe the cause of the issue is a codegen bug in gcc that seems to manifest in Spirit Classic. Namely, section IDs aren't being correctly produced when the qbk file contains:

[include:foo include-inc.quickbook]

More can be seen here: https://github.com/boostorg/quickbook/actions/runs/3046704503

This seems to be because of a codegen bug caused by certain versions of gcc (seemingly 9 through 12.1) with -O2 and higher.

I can replicate the issue here: https://godbolt.org/z/oa5b6j6Pd

Under -O1 and lower, the output is:

Current iterator range: foo

but with -O2 and higher,

Current iterator range: :foo

This is incorrect and is what is causing quickbook to generate incorrect output, which causes the test to fail.

I know that Classic is likely not under maintenance anymore but because quickbook is such an integral part of Boost and its toolchain, this might be worth fixing.

Let me know if any more information is required! The code in the Compiler Explorer example is a close copy-paste of the code used by quickbook today but can probably be simplified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions