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

    <tr>
        <th>Summary</th>
        <td>
            Missing -Wformat warning for `execl` and missing sentinel value
        </td>
    </tr>

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

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

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

<pre>
    We've hit a few issues which only arise with Apple's arm64 ABI in Gentoo which end up being invalid/missing sentinel values passed to variadic functions:
* flex (https://bugs.gentoo.org/871324, https://github.com/westes/flex/pull/554)
* b2 (https://bugs.gentoo.org/895524, https://github.com/bfgroup/b2/pull/214)

GCC's `-Wformat` picks this up at least for some standard library functions like `execl`, but Clang doesn't seem to emit a warning.

```c
#include <unistd.h>

int main() {
    execl("/bin/sh", "sh", "-c", "echo hi", 0);
}
```

With GCC trunk (so ~13) (https://godbolt.org/z/aYEfjbYnf):
```console
<source>: In function 'main':
<source>:4:5: warning: missing sentinel in function call [-Wformat=]
    4 |     execl("/bin/sh", "sh", "-c", "echo hi", 0);
      |     ^~~~~
```

With Clang trunk (so ~17) (https://godbolt.org/z/PjEx3ex4c):
```console
[no warning]
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vc9vqzgQ_muGy6gRGAzhwCElpXqHlfZWvaOBAdwaG2GTtHvI374ySZv0dbWvlyflxzD2zDf-vvEgrJW9JiqA3wPfB2Jxg5kLN5AVo_8GtWnfiicClh0IB-lQYEdHlNYuZPE4yGZAo9UbillawqN0A-6mSfkIi2Ie0wR39z9Qanwk7Yy5xJBucZmwJql7lPoglGyBVaO01nssaSc1KTwI5YEmYS216AwexCxFKxvsFt04abSFeAfhHsIdsB12il4R2HZwblpXWAWsqpfebvoVf2PmHli1zaKYJcBK_Lyzl25Y6k1jRmDVkawjC6zyWYFV06IUsIrzBFh-xazZtxBzzn-LWHf9bJbJW-wKyKIbwPX3sSxXgiEN7546M4_CQRriJJsXi26Q1pMrHCoS1mFnZrRmJLRO6FbMLSpZz2J-u5KISr6QT0ev1ChIQ19ovTgsldA9toasBpY5tESj14HGtRmOYtZS95vb4nz0-mneOYqlbtTSEkJcLlpa124GiB9ug6R2OAqpgW2B5QjZ_dmPiHiuyS94Umq_qbLD-lQiMHZr3zVXm5rB4CAvjtBzGF_SQrb_pdjbYp58Gz-WJbp50S9eXWvwFMVrZb9K3Zu2NspdZP4HWCV-PnTP9U_drYhfWDHaGkUXb1xas8wNeTriHf7QH5ogsOzMSHZN8nl7AvGO-7CLDN78coXkTcpGKIXA7z-aJt4D31-ZThCyEv8Q52veDwDgD6fT6fQ7Fc7991mH7Js6_P388BrTa9J8Qwd-r80Hjfy_myNoi7jN41wEVERpluZhxLcsGIqU15xEnrFa8CivuyaPu4glUZfxKKm3YSALFrI4ZCyMYp4nbMPytE4iTl1LSRvmBElIo5Bqo9Rh9EcI1hFbpOF2GwVK1KTsOqUZ0-_z13PM98Fc-Jg7P3EgCZW0zl6zOOkUFX9deuJd9veDrpPh5tKj0O3XBlpncLDMqvifyeURL39302yeqXHAqvN7Ali1nuPfAAAA__-vkeZj">