public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95639] New: wrong error location
@ 2020-06-11 13:01 f.heckenbach@fh-soft.de
2020-06-11 13:30 ` [Bug c++/95639] " mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: f.heckenbach@fh-soft.de @ 2020-06-11 13:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95639
Bug ID: 95639
Summary: wrong error location
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: f.heckenbach@fh-soft.de
Target Milestone: ---
This may be similar to #93979, but I'm not sure.
% cat test.cpp
#define S(A) sizeof (A)
int main ()
{
int a[10];
return (int) S (a);
}
% g++ -Wold-style-cast test.cpp
t.cpp: In function 'int main()':
t.cpp:1:23: warning: use of old-style cast to 'int' [-Wold-style-cast]
1 | #define S(A) sizeof (A)
| ^
t.cpp:6:16: note: in expansion of macro 'S'
6 | return (int) S (a);
| ^
The warning itself is correct, but the location and the note point at the
macro, while the offending cast is in main.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/95639] wrong error location
2020-06-11 13:01 [Bug c++/95639] New: wrong error location f.heckenbach@fh-soft.de
@ 2020-06-11 13:30 ` mpolacek at gcc dot gnu.org
2020-06-11 13:40 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-11 13:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95639
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2020-06-11
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/95639] wrong error location
2020-06-11 13:01 [Bug c++/95639] New: wrong error location f.heckenbach@fh-soft.de
2020-06-11 13:30 ` [Bug c++/95639] " mpolacek at gcc dot gnu.org
@ 2020-06-11 13:40 ` mpolacek at gcc dot gnu.org
2020-06-18 18:24 ` mpolacek at gcc dot gnu.org
2021-11-13 10:10 ` egallager at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-11 13:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95639
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
With a trivial patch we generate:
95639.C: In function ‘int main()’:
95639.C:6:14: warning: use of old-style cast to ‘int’ [-Wold-style-cast]
6 | return (int) S (a);
| ^
| -----
| static_cast<int> ()
I suspect that's much better.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/95639] wrong error location
2020-06-11 13:01 [Bug c++/95639] New: wrong error location f.heckenbach@fh-soft.de
2020-06-11 13:30 ` [Bug c++/95639] " mpolacek at gcc dot gnu.org
2020-06-11 13:40 ` mpolacek at gcc dot gnu.org
@ 2020-06-18 18:24 ` mpolacek at gcc dot gnu.org
2021-11-13 10:10 ` egallager at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-18 18:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95639
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
Assignee|mpolacek at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Not that trivial because it breaks -fdiagnostics-generate-patch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/95639] wrong error location
2020-06-11 13:01 [Bug c++/95639] New: wrong error location f.heckenbach@fh-soft.de
` (2 preceding siblings ...)
2020-06-18 18:24 ` mpolacek at gcc dot gnu.org
@ 2021-11-13 10:10 ` egallager at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-13 10:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95639
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> With a trivial patch we generate:
>
> 95639.C: In function ‘int main()’:
> 95639.C:6:14: warning: use of old-style cast to ‘int’ [-Wold-style-cast]
> 6 | return (int) S (a);
> | ^
> | -----
> | static_cast<int> ()
>
>
> I suspect that's much better.
(In reply to Marek Polacek from comment #3)
> Not that trivial because it breaks -fdiagnostics-generate-patch.
Could you post the patch anyways so we can figure out how to fix it?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-13 10:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 13:01 [Bug c++/95639] New: wrong error location f.heckenbach@fh-soft.de
2020-06-11 13:30 ` [Bug c++/95639] " mpolacek at gcc dot gnu.org
2020-06-11 13:40 ` mpolacek at gcc dot gnu.org
2020-06-18 18:24 ` mpolacek at gcc dot gnu.org
2021-11-13 10:10 ` egallager 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).