Skip to content

gcc 14.2 bug: array subscript out of bounds with JSON_DIAGNOSTICS #4819

Description

@ryanjmulder

Description

std::vector< json > jsons{};
jsons.emplace_back( json( { { "key", "value" } } ) );

yields error: array subscript is partly outside array bounds of 'unsigned char [32]' [-Werror=array-bounds=]
When built with JSON_DIAGNOSTICS and -O3 and -Wall

It appears to be a gcc bug fixed in 15, but I didn't know if you wanted to implement a work-around or not.

Reproduction steps

See compiler explorer here: https://godbolt.org/z/fnrzsqKeT

Expected vs. actual results

compiles

Minimal code example

Error messages

Compiler and operating system

Ubuntu 24.04, gcc 14

Library version

3.12.0 and HEAD today (568b708)

Validation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: invalidthe issue is not related to the library

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions