https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118214

            Bug ID: 118214
           Summary: [15 regression] OpenTTD test failure with C++ large
                    initializer
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Originally reported downstream in Gentoo at https://bugs.gentoo.org/946984 with
OpenTTD tests failing, e.g. "PartialPixelTest - One corner up slopes -
SLOPE_N".

```
#include <array>
#include <vector>

enum Slope {
    SLOPE_N = 8U
};

static const unsigned int TILE_SIZE = 16U;

__attribute__((noipa))
bool CheckPartialPixelZ(Slope slope, std::array<int, TILE_SIZE * TILE_SIZE>
expected)
{
        int actual[TILE_SIZE * TILE_SIZE] = {8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3,
2, 2, 1, 1, 0,
                7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0,
                7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0,
                6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0,
                6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0,
                5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0,
                5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0,
                4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                4, 3};
        for (unsigned int i = 0; i < expected.size(); i++) {
                if (actual[i] != expected[i]) __builtin_trap();
        }
        return true;
}

int main() {
    CheckPartialPixelZ(SLOPE_N, {
                8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0,
                7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0,
                7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0,
                6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0,
                6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0,
                5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0,
                5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0,
                4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                4, 3, }
    );
}
```

Reply via email to