public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107162] New: -Wmisleading-indentation is blinded by comments
@ 2022-10-05 18:37 kees at outflux dot net
2022-10-06 10:47 ` [Bug c/107162] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: kees at outflux dot net @ 2022-10-05 18:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107162
Bug ID: 107162
Summary: -Wmisleading-indentation is blinded by comments
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: kees at outflux dot net
Target Milestone: ---
Hi,
Similar to this bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106528
-Wmissing-indentation is blinded by comments:
int square(int num) {
if (num == 1)
goto fail;
// if (num == 0)
goto fail;
if (num > 20)
return num * num;
else
return num + num;
fail:
return -1;
}
The above case does not warn in GCC, but does in Clang:
https://godbolt.org/z/bMG5jM9Ga
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/107162] -Wmisleading-indentation is blinded by comments
2022-10-05 18:37 [Bug c/107162] New: -Wmisleading-indentation is blinded by comments kees at outflux dot net
@ 2022-10-06 10:47 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-06 10:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107162
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I suppose the better diagnostic would point out that
if (num > 20)
return num * num;
else
return num + num;
is unreachable?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-06 10:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 18:37 [Bug c/107162] New: -Wmisleading-indentation is blinded by comments kees at outflux dot net
2022-10-06 10:47 ` [Bug c/107162] " rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).