[libcxx-commits] [clang] [libcxx] [Clang] Diagnose forming references to nullptr (PR #143667)
Nathan Chancellor via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 17 09:35:49 PDT 2025
nathanchance wrote:
I am seeing a new build failure when building the Linux kernel as a result of this change.
```
drivers/tty/sysrq.c:486:2: error: initializer element is not a compile-time constant
486 | &sysrq_showlocks_op, /* d */
| ^~~~~~~~~~~~~~~~~~~
```
as a result of
```c
#ifdef CONFIG_LOCKDEP
static void sysrq_handle_showlocks(u8 key)
{
debug_show_all_locks();
}
static const struct sysrq_key_op sysrq_showlocks_op = {
.handler = sysrq_handle_showlocks,
.help_msg = "show-all-locks(d)",
.action_msg = "Show Locks Held",
};
#else
#define sysrq_showlocks_op (*(const struct sysrq_key_op *)NULL)
#endif
```
This build does not have LOCKDEP enabled so `&sysrq_showlocks_op` becomes `&(*(const struct sysrq_key_op *)((void *)0))`. Is the error expected in this case? I am not sure if this construct is used elsewhere in the kernel but it was in the first build that was attempted during a compiler upgrade.
https://github.com/llvm/llvm-project/pull/143667
More information about the libcxx-commits
mailing list