https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117853
Bug ID: 117853 Summary: "warning: '?:' using integer constants in boolean context, the expression will always evaluate to 'true' [-Wint-in-bool-context]" but no ?: in sight Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nabijaczleweli at nabijaczleweli dot xyz Target Milestone: --- With gcc (Debian 14.2.0-8) 14.2.0 I just got /bin/bash ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -DSYSCONFDIR=\"/etc\" -DPKGDATADIR=\"/usr/share/ltrace\" -I./sysdeps/linux-gnu/riscv64 -I./sysdeps/linux-gnu -I./sysdeps -I. -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Wsign-compare -Wfloat-equal -Wformat-security -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/tmp/ltrace=. -fstack-protector-strong -Wformat -Werror=format-security -c -o proc.lo proc.c libltrace.c: In function 'signal_exit': libltrace.c:83:21: warning: '?:' using integer constants in boolean context, the expression will always evaluate to 'true' [-Wint-in-bool-context] 83 | exiting = 1 + !!os_ltrace_exiting_sighandler(); | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ with bool exiting; and int os_ltrace_exiting_sighandler(void); The warning is valid in principle (this /is/ always true), but there's no ?: in sight. So the description should probably drop the ?: bit? Maybe? The following repros this on current sid: #include <stdbool.h> bool exiting; int os_ltrace_exiting_sighandler(void); int main() { exiting = 1 + !!os_ltrace_exiting_sighandler(); }