<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59792>59792</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] incorrect code generation when building gawk 5.2.1 using -O2/-O3
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          0xC0ncord
      </td>
    </tr>
</table>

<pre>
    It was found that when building gawk 5.2.1 with `-O2` or `-O3`, incorrect machine code is generated which is causing differing runtime behavior than expected.

# Background
Originally I ran into this when upgrading gawk on my personal Gentoo systems to 5.2.1. There is a particular regex[1] used in plymouth which was suddenly erroring that did not previously. Downgrading to gawk 5.1.1, building it with gcc, or disabling compiler optimizations would work around the issue.

This issue is being submitted after some discussion[2] on the gawk-bug mailing list, particularly because of these findings[3].

[1] https://gitlab.freedesktop.org/plymouth/plymouth/-/blob/main/scripts/plymouth-set-default-theme.in#L50
[2] https://lists.gnu.org/archive/html/bug-gawk/2022-12/msg00010.html
[3] https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00002.html
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVM2OozgQfhpzKYGMCWRy4DA9EauRVurLvICxC6htYyP_JJ19-pVJ0r2t0V72khDHfPX9lD4ZAs0WsWftC2vPhUxxcb7n7z-4Vc7rYnT61v-McJUBJpeshrjICNcFLYyJjCY7wyyvb9BWoqrhSnEB1vHyVbCOg_P3Hw3rOBM_gDKqRxVhlWohi6CcRqAAM1r0MqKG60JqyUdKppDhNU0T-vzkk420Ioy4yAs5n8lYwPcNVURdMX5m_PvjUzTwItXb7DPr-9mrp5msNOYGP8FLC2Sjg7hQuAtK2-zlpyJnYb3Bhj44Kw38gTY6B-EWIq4BortLruDXgn7XIGGTPpJKRnrwOOM7a19q1p4hBdRAFjZzW12Ky0NkdjUkrdGaG6D3ble5O6xJg3URNo8XcimYWwVnd7VPhtE9ba-rOlv7kQbFewqzUvncedAU5Gjyf8qtGxn04LZIK_0tIzkb4OqS0XB1_g2kf6ScFYWEX0z9la3aj7PcETNkSONKMQcnp4geglsxT1QpBHKWtS8iO-Dsjpk5l2OaYZW0MzIUYqb56Zy5wYg5ewQ35ZcCwkQ2awusfWlYe_6a9MPjJcYtsOY7EwMTw0zRyLGaPKLG8BbdVjk_MzE8I_j6WDIxjMaNTAyrJMvEEJSnLYZ_XSsDxlLjJJOJZVxwxSrfbP5s-QcT8TuTrDBUs00PAtKrhS7IxLDE1eS5aS6zL0wMggtR1iKzCDPnvObVfukJ3_xfeJsMjfcBTcnrjwFc7AMK3Tf61JxkgX3dHUV3OtTHulj6bmpanL51krd85C0_ftNScFmfUB8PusOC-gzJay5EXXd1XYmmO3yr2_o4Na061CM7cMxhV8Zc1syx2Beob0_HkyiMHNGEvX6EsHi9bxcT2cfC9_mdvC6BHfhd6AdKpGj23lJG2jn78lkue6k8GoWc_e-6uhdMLisxlK9Nkbzpf9ujJY2Vcmv22lyeX-Xm3V-oIhPDTjkvyi7pnwAAAP__WA7BRQ">