public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line.
@ 2020-11-21 8:27 lance.delahaye at gmail dot com
2020-11-21 9:21 ` [Bug c/97932] " pinskia at gcc dot gnu.org
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: lance.delahaye at gmail dot com @ 2020-11-21 8:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Bug ID: 97932
Summary: Preprocessor, generated error dumps most of the source
file, not just one line.
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: lance.delahaye at gmail dot com
Target Milestone: ---
Created attachment 49608
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49608&action=edit
Minimal source (too many comments maybe) but no #includes needed.
When error generated originating expanding #define, entire source between line
of #define and the line invoking the macro is listed as error line. Can be
hundreds of lines, most of the source file.
Verified on 6.3 and 8.2, not tried most recent.
Attached source .c file, no #include dependancies.
To reproduce:
gcc -C _gcc_container_of_bug.c
gcc --version
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] Preprocessor, generated error dumps most of the source file, not just one line.
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
@ 2020-11-21 9:21 ` pinskia at gcc dot gnu.org
2020-11-21 10:19 ` lance.delahaye at gmail dot com
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-11-21 9:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Keywords| |diagnostic
Last reconfirmed| |2020-11-21
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed,
Min example:
#define container_of( P, T, M ) ( (void)((P) - &((T*)0)->M), (T*)((char*)(P) -
(int)&((T*)0)->M) )
typedef struct {
short a;
short b;
} test_t;
int main( int argc, const char *argv[] )
{
short c;
char b;
tptr = container_of( b, test_t, b );
return 0;
}
---- CUT ----
For some reason the preprocessor or the C front-end thinks the range goes all
the way to the closing ) on the container_of line.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] Preprocessor, generated error dumps most of the source file, not just one line.
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
2020-11-21 9:21 ` [Bug c/97932] " pinskia at gcc dot gnu.org
@ 2020-11-21 10:19 ` lance.delahaye at gmail dot com
2020-11-21 10:26 ` lance.delahaye at gmail dot com
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: lance.delahaye at gmail dot com @ 2020-11-21 10:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
--- Comment #2 from Lance de la Haye <lance.delahaye at gmail dot com> ---
Also verified with mingw64 build from winlibs.com
gcc --version
gcc.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] Preprocessor, generated error dumps most of the source file, not just one line.
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
2020-11-21 9:21 ` [Bug c/97932] " pinskia at gcc dot gnu.org
2020-11-21 10:19 ` lance.delahaye at gmail dot com
@ 2020-11-21 10:26 ` lance.delahaye at gmail dot com
2020-11-21 14:34 ` [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941 hjl.tools at gmail dot com
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: lance.delahaye at gmail dot com @ 2020-11-21 10:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Lance de la Haye <lance.delahaye at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|8.2.0 |10.2.0
--- Comment #3 from Lance de la Haye <lance.delahaye at gmail dot com> ---
Also verified with mingw64 build from winlibs.com
gcc --version
gcc.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (2 preceding siblings ...)
2020-11-21 10:26 ` lance.delahaye at gmail dot com
@ 2020-11-21 14:34 ` hjl.tools at gmail dot com
2020-11-23 7:31 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: hjl.tools at gmail dot com @ 2020-11-21 14:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dmalcolm at redhat dot com
Summary|Preprocessor, generated |[8/9/10/11 Regression]
|error dumps most of the |Preprocessor, generated
|source file, not just one |error dumps most of the
|line. |source file, not just one
| |line by r6-5941
Target Milestone|--- |8.5
--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
It is caused by r6-5941.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (3 preceding siblings ...)
2020-11-21 14:34 ` [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941 hjl.tools at gmail dot com
@ 2020-11-23 7:31 ` rguenth at gcc dot gnu.org
2021-02-03 13:07 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-23 7:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (4 preceding siblings ...)
2020-11-23 7:31 ` rguenth at gcc dot gnu.org
@ 2021-02-03 13:07 ` jakub at gcc dot gnu.org
2021-02-03 14:21 ` dmalcolm at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-03 13:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
David, do you think you could have a look? Perhaps having some upper limit on
the number of lines and not print the source if it would be too many lines?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (5 preceding siblings ...)
2021-02-03 13:07 ` jakub at gcc dot gnu.org
@ 2021-02-03 14:21 ` dmalcolm at gcc dot gnu.org
2021-02-04 20:23 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-02-03 14:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dmalcolm at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |dmalcolm at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Mine
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (6 preceding siblings ...)
2021-02-03 14:21 ` dmalcolm at gcc dot gnu.org
@ 2021-02-04 20:23 ` cvs-commit at gcc dot gnu.org
2021-02-04 20:30 ` [Bug c/97932] [8/9/10 " dmalcolm at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-04 20:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:
https://gcc.gnu.org/g:65c1cb358999e9d1618834af341b31837ede839e
commit r11-7105-g65c1cb358999e9d1618834af341b31837ede839e
Author: David Malcolm <dmalcolm@redhat.com>
Date: Thu Feb 4 15:20:59 2021 -0500
diagnostics: fix excessive range-printing involving macros [PR97932]
PR c/97932 describes a bug in which diagnostic_show_locus prints most
of a source file.
The issue is that it prints a range in which the start and end locations
are part of the same macro map, but the start location is for a token in
the definition of the macro, whereas the end location is for a token in
an argument of the macro.
This patch extends compatible_locations_p to require that range-printing
of macro maps requires the location to either be both for the definition
of the macro, or both for the arguments of the macro (not one of each),
fixing the issue.
gcc/ChangeLog:
PR c/97932
* diagnostic-show-locus.c (compatible_locations_p): Require
locations in the same macro map to be either both from the
macro definition, or both from the macro arguments.
gcc/testsuite/ChangeLog:
PR c/97932
* gcc.dg/pr97932.c: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [8/9/10 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (7 preceding siblings ...)
2021-02-04 20:23 ` cvs-commit at gcc dot gnu.org
@ 2021-02-04 20:30 ` dmalcolm at gcc dot gnu.org
2021-05-14 9:54 ` [Bug c/97932] [9/10 " jakub at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-02-04 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[8/9/10/11 Regression] |[8/9/10 Regression]
|Preprocessor, generated |Preprocessor, generated
|error dumps most of the |error dumps most of the
|source file, not just one |source file, not just one
|line by r6-5941 |line by r6-5941
--- Comment #8 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed on trunk by above commit.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [9/10 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (8 preceding siblings ...)
2021-02-04 20:30 ` [Bug c/97932] [8/9/10 " dmalcolm at gcc dot gnu.org
@ 2021-05-14 9:54 ` jakub at gcc dot gnu.org
2021-06-01 8:18 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 9:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|8.5 |9.4
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [9/10 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (9 preceding siblings ...)
2021-05-14 9:54 ` [Bug c/97932] [9/10 " jakub at gcc dot gnu.org
@ 2021-06-01 8:18 ` rguenth at gcc dot gnu.org
2022-05-27 9:43 ` [Bug c/97932] [10 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01 8:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.4 |9.5
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [10 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (10 preceding siblings ...)
2021-06-01 8:18 ` rguenth at gcc dot gnu.org
@ 2022-05-27 9:43 ` rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07 9:13 ` rguenth at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [10 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (11 preceding siblings ...)
2022-05-27 9:43 ` [Bug c/97932] [10 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07 9:13 ` rguenth at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c/97932] [10 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
` (12 preceding siblings ...)
2022-06-28 10:42 ` jakub at gcc dot gnu.org
@ 2023-07-07 9:13 ` rguenth at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 9:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97932
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.0
Resolution|--- |FIXED
Known to fail| |10.5.0
Known to work| |11.1.0
Status|ASSIGNED |RESOLVED
--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 11.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2023-07-07 9:13 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21 8:27 [Bug c/97932] New: Preprocessor, generated error dumps most of the source file, not just one line lance.delahaye at gmail dot com
2020-11-21 9:21 ` [Bug c/97932] " pinskia at gcc dot gnu.org
2020-11-21 10:19 ` lance.delahaye at gmail dot com
2020-11-21 10:26 ` lance.delahaye at gmail dot com
2020-11-21 14:34 ` [Bug c/97932] [8/9/10/11 Regression] Preprocessor, generated error dumps most of the source file, not just one line by r6-5941 hjl.tools at gmail dot com
2020-11-23 7:31 ` rguenth at gcc dot gnu.org
2021-02-03 13:07 ` jakub at gcc dot gnu.org
2021-02-03 14:21 ` dmalcolm at gcc dot gnu.org
2021-02-04 20:23 ` cvs-commit at gcc dot gnu.org
2021-02-04 20:30 ` [Bug c/97932] [8/9/10 " dmalcolm at gcc dot gnu.org
2021-05-14 9:54 ` [Bug c/97932] [9/10 " jakub at gcc dot gnu.org
2021-06-01 8:18 ` rguenth at gcc dot gnu.org
2022-05-27 9:43 ` [Bug c/97932] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07 9:13 ` 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).