[Bug c/86765] New: invalid -Wmisleading-indentation for double macro expansion with pragmas
ndesaulniers at google dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 31 20:48:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86765
Bug ID: 86765
Summary: invalid -Wmisleading-indentation for double macro
expansion with pragmas
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: ndesaulniers at google dot com
Target Milestone: ---
Developing a patch for the Linux kernel, I hit a -Wmisleading-indentation
warning for a particular configuration in gcc 6, 7, and 8.
This is the paired down test case: https://godbolt.org/g/b5dsqH
Looking at the output, the warning is technically correct (puts() was called
unconditionally), but I don't think the compiled code is. Compared to clang,
clang compiles the conditional check (as expected), but gcc does not.
The kernel patch is trying to add compiler specific pragma's to ignore
clang-7's -Wreturn-stack-address. We could be better about not emitted
_Pragma's for push/pop if we're not clang, but this still seems like a
miscompilation from gcc to me.
Is there a special rule about GNU statement expressions [0] that I'm missing?
[0] https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
More information about the Gcc-bugs
mailing list