public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* False positive misleading indentation warning
@ 2023-11-01  8:11 Rene Kita
  2023-11-01  8:28 ` Martin Uecker
  2023-11-01 11:23 ` Jonathan Wakely
  0 siblings, 2 replies; 3+ messages in thread
From: Rene Kita @ 2023-11-01  8:11 UTC (permalink / raw)
  To: gcc

Since I'm unable to create an account to report a bug and got no reply
from gcc-bugzilla-account-request@gcc.gnu.org I'll dump this here.

Depending on the placement of a label Gcc gives a false positive warning
about misleading indentation. Below is a minimal working example to
reproduce and the output from Gcc.

Arsen Arsenović was so kind to confirm (on IRC) this bug is reproducible
with a current Gcc and asked me to report it.

/*
 * miside.c
 * MWE for a wrong warning shown with gcc -Wmisleading-indentation
 */

void
good(int c)
{
label:
	while (c != '-');
	if (c != '-')
		goto label;
}

void
bad(int c)
{
label:	while (c != '-');
	if (c != '-')
		goto label;
}

/*
% gcc -c -Wmisleading-indentation miside.c
miside.c: In function ‘bad’:
miside.c:18:9: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   18 | label:  while (c != '-');
      |         ^~~~~
miside.c:19:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
   19 |         if (c != '-')
      |         ^~
*/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: False positive misleading indentation warning
  2023-11-01  8:11 False positive misleading indentation warning Rene Kita
@ 2023-11-01  8:28 ` Martin Uecker
  2023-11-01 11:23 ` Jonathan Wakely
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Uecker @ 2023-11-01  8:28 UTC (permalink / raw)
  To: Rene Kita, gcc


I think this is the same bug already filed here:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70954

Martin

Am Mittwoch, dem 01.11.2023 um 09:11 +0100 schrieb Rene Kita:
> Since I'm unable to create an account to report a bug and got no reply
> from gcc-bugzilla-account-request@gcc.gnu.org I'll dump this here.
> 
> Depending on the placement of a label Gcc gives a false positive warning
> about misleading indentation. Below is a minimal working example to
> reproduce and the output from Gcc.
> 
> Arsen Arsenović was so kind to confirm (on IRC) this bug is reproducible
> with a current Gcc and asked me to report it.
> 
> /*
>  * miside.c
>  * MWE for a wrong warning shown with gcc -Wmisleading-indentation
>  */
> 
> void
> good(int c)
> {
> label:
> 	while (c != '-');
> 	if (c != '-')
> 		goto label;
> }
> 
> void
> bad(int c)
> {
> label:	while (c != '-');
> 	if (c != '-')
> 		goto label;
> }
> 
> /*
> % gcc -c -Wmisleading-indentation miside.c
> miside.c: In function ‘bad’:
> miside.c:18:9: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
>    18 | label:  while (c != '-');
>       |         ^~~~~
> miside.c:19:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
>    19 |         if (c != '-')
>       |         ^~
> */


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: False positive misleading indentation warning
  2023-11-01  8:11 False positive misleading indentation warning Rene Kita
  2023-11-01  8:28 ` Martin Uecker
@ 2023-11-01 11:23 ` Jonathan Wakely
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2023-11-01 11:23 UTC (permalink / raw)
  To: gcc

On Wed, 1 Nov 2023 at 08:12, Rene Kita wrote:
>
> Since I'm unable to create an account to report a bug and got no reply
> from gcc-bugzilla-account-request@gcc.gnu.org

You did get a reply. Jose Marchesi replied to you 1.5 hours after your
email, but you didn't reply-all with the requested info that we needed
to confirm you weren't the spammer who was requesting an account every
few hours with different addresses.
If you still want an account, I can create one for you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-01 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01  8:11 False positive misleading indentation warning Rene Kita
2023-11-01  8:28 ` Martin Uecker
2023-11-01 11:23 ` Jonathan Wakely

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).