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

    <tr>
        <th>Summary</th>
        <td>
            Segfault with afl lto
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          kroeckx
      </td>
    </tr>
</table>

<pre>
    When using afl's lto mode, it seems that some files generate wrong code under some circumstances. One case I have is in OpenSSL's OpenSSL_1_1_1-stable branch (commit a632d534c73eeb3e3db8c7540d811194ef7c79ff). I build it using:
```
CC=afl-clang-lto ./config no-shared
make
```

I then get:
```
fuzz/x509-test ../fuzz-corpora/x509/e6803da95b0b98674f147f4b5c397abdcb84c29c 
# ../fuzz-corpora/x509/e6803da95b0b98674f147f4b5c397abdcb84c29c
Segmentation fault
```

The fuzz-corpora is a separate repository of the OpenSSL project.

If I add `-O1` to the config option, the problem goes away. Adding `-fno-strict-aliasing` does not make the problem go away.

I'm running this on Debian, with the following versions:
afl++ 4.08c-1
clang 1:14.0-55.7
clang-14 + llvm-14 1:14.0.6-13

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMuO5CYU_Rpqc2ULA34tvOiHSmopUi86UpYRj2ubNIYS4K7p-foIV00yEyVZjWzZGA7n3McxMiW7eMSJtI-kfT7JPa8hTu8xoH7_clLBfE6_rehhT9YvIGdHWJ_A5QBbMEjYE9gMCXFLkFeZIYUNYbYOEyzoMcqMcI3BL6CDQdi9wXgDaRv1vqUsvcZUw6tH0DIhvMAqPxBsAuvh9YL-7e2XQ_Q-_r0pV5WyVA5BRen1CoQNOmybzSA7zkzLhe45ouLIjRp03wpqhqZpRoFzr_txngkba3gBtVtnSg5HgoQ_EPpM6APp6P0-Pp-eCH-Ws6u0k36pSvo1YWcd_GwX8KFKq4xobuBNvuO_styeL5BLQRfM_6U271-_Enb-0tKxypgy1EWszFY6xEuI8r5K2Bm7gXIjx1ZRNQ5dL-ZG9LNQreZjL5XRahCajRruSoz_DLYb2RsuG_ossw0eZrm7_D9p_7oifC9aGiwh4UUeHol4CcnmED8hzKVC39oNlxj-QJ3rH2o4wwtIY4B0tHptSEchh2PXvSXhUoIq9iyTlxiUww2WgAnkVX7W8GBMMXTZP5f-5Wh1rqSz8vBBR8EUsA8ZSj__QXMj-SEiwvoN4u59oc2rTRA8PKOy8gjjavN6kMzBuXAtoA-MyQaf_rLB8Xc9EvYIoqaDrprb9OE5aAh_aERNq7at--8WqkZA2eLcx1bG33B1VzX8hjuZiZuRj_KEU9ONvOdi5O1pnQaqhKZs7FTDqOnnTgvaCiG5oaJnkp7sxCjjdKScjm3L29ow2gvWMqZRj3oYiaC4SevqIl-HuJxsSjtOXcuYODmp0KXjbGHM4xWORcJYOWridISs9iURQZ1NOf3Nkm12OL3hctjqVj05u3LwnPbopjXny1E4dibsvNi87qrWYSPsXDjur-ruHcLOh3Ii7HxE9mcAAAD__97-g9c">