https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105316
Bug ID: 105316 Summary: Seemingly bogus -Wdangling-pointer from ppc/ppc64 kernel printk with gcc12 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: raj.khem at gmail dot com Target Milestone: --- I have reduced this case from ppc kernel 5.15, this breaks the kernel build as the warning is treated as error. ftrace.i ====================== int _printk(const char *fmt, ...); static void ftrace_modify_code() { _printk("replaced (%s)", ({ char __str[sizeof("00000000 00000000")]; __str; })); } ===================== powerpc64le-yoe-linux-musl-gcc -c ftrace.i -Werror=dangling-pointer ftrace.i: In function 'ftrace_modify_code': ftrace.i:4:2: error: using a dangling pointer to '__str' [-Werror=dangling-pointer=] 4 | _printk("replaced (%s)", ({ char __str[sizeof("00000000 00000000")]; __str; })); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ftrace.i:4:35: note: '__str' declared here 4 | _printk("replaced (%s)", ({ char __str[sizeof("00000000 00000000")]; __str; })); | ^~~~~ cc1: some warnings being treated as errors