public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108660] New: Wrong location for first statement of for loop (-Wunused-value)
@ 2023-02-03 18:19 pinskia at gcc dot gnu.org
  2023-02-06 14:20 ` [Bug c/108660] " marxin at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-03 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108660
           Summary: Wrong location for first statement of for loop
                    (-Wunused-value)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
void t1(int t)
{
  for (t; t < 10; t++)
    ;
}
```
This should warn about a statement with no effect and GCC does but the location
marker is incorrect. The C front-end underlines the for keyword rather than the
expression `t`.
```
<source>: In function 't1':
<source>:3:3: warning: statement with no effect [-Wunused-value]
    3 |   for (t; t < 10; t++)
      |   ^~~
```


Note the C++ front-end gets it correct:
```
<source>: In function 'void t1(int)':
<source>:3:8: warning: statement has no effect [-Wunused-value]
    3 |   for (t; t < 10; t++)
      |        ^
```

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

* [Bug c/108660] Wrong location for first statement of for loop (-Wunused-value)
  2023-02-03 18:19 [Bug c/108660] New: Wrong location for first statement of for loop (-Wunused-value) pinskia at gcc dot gnu.org
@ 2023-02-06 14:20 ` marxin at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-02-06 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-06
             Status|UNCONFIRMED                 |NEW

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

end of thread, other threads:[~2023-02-06 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 18:19 [Bug c/108660] New: Wrong location for first statement of for loop (-Wunused-value) pinskia at gcc dot gnu.org
2023-02-06 14:20 ` [Bug c/108660] " marxin 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).