public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp
@ 2020-06-25 7:06 dev-zero at gentoo dot org
2020-06-25 7:22 ` [Bug preprocessor/95889] " dev-zero at gentoo dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dev-zero at gentoo dot org @ 2020-06-25 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Bug ID: 95889
Summary: corrupt size vs. prev_size and hang when using
__has_include with -traditional-cpp
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: dev-zero at gentoo dot org
Target Milestone: ---
Part of my testing for issues like https://github.com/evaleev/libint/issues/173
with GCC 10.1 I came up with a silly test header:
****snip****
#if defined __has_include
# if __has_include(<stdio.h>)
hello there
# endif
#endif
****snip****
which works as expected with `cpp test.h`:
****snip****
# 1 "test.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "test.h"
hello there
****snip****
But gives the following and hangs when running with `cpp -traditional-cpp
test.h`:
****snip****
# 1 "test.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 17 "/usr/include/stdc-predef.h" 3 4
[...]
# 32 "<command-line>" 2
# 1 "test.h"
test.h:3: error: missing '(' before "__has_include" operand
3 | # if __has_include(<stdio.h>)
|
test.h:3: error: operator "__has_include" requires a header-name
test.h:3: warning: null character(s) ignored
test.h:3: error: missing binary operator before token "q"
*** Error in
`/data/tiziano/cp2k/tools/toolchain/install/gcc-10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/cc1':
corrupted size vs. prev_size: 0x0000000002a517a0 ***
test.h:1: confused by earlier errors, bailing out
****snip****
Besides this issue with the compiler itself, I wonder what the correct
invocation of `__has_include` in traditional mode is (because it seems to be
defined).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug preprocessor/95889] corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
@ 2020-06-25 7:22 ` dev-zero at gentoo dot org
2020-07-24 10:34 ` [Bug preprocessor/95889] __has_include evaluated even if disabled (with cpp in traditional-mode) dev-zero at gentoo dot org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dev-zero at gentoo dot org @ 2020-06-25 7:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
--- Comment #1 from Tiziano Müller <dev-zero at gentoo dot org> ---
Unfortunately `__has_include` is even being parsed (in traditional-cpp mode) if
enclosed in a `if 0 ... endif`:
****snip****
#if 0
#if __has_include(<foo.h>)
#endif
#endif
****snip****
which gives:
****snip****
# 32 "<command-line>" 2
# 1 "test2.h"
test2.h:3: error: missing '(' before "__has_include" operand
3 | #if __has_include(<foo.h>)
|
test2.h:3: error: operator "__has_include" requires a header-name
*** Error in
`/data/tiziano/cp2k/tools/toolchain/install/gcc-10.1.0/lib/gcc/x86_64-pc-linux-gnu/10.1.0/cc1':
corrupted size vs. prev_size: 0x000000000249a7e0 ***
test2.h:1: confused by earlier errors, bailing out
****snip****
while enclosing it in parenthesis at least fixes that, such that the following
parses fine:
****snip****
#if 0
#if (__has_include(<foo.h>))
#endif
#endif
****snip****
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug preprocessor/95889] __has_include evaluated even if disabled (with cpp in traditional-mode)
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
2020-06-25 7:22 ` [Bug preprocessor/95889] " dev-zero at gentoo dot org
@ 2020-07-24 10:34 ` dev-zero at gentoo dot org
2020-07-28 7:56 ` tm@dev-zero.ch
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dev-zero at gentoo dot org @ 2020-07-24 10:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Tiziano Müller <dev-zero at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|10.1.0 |10.2.0
Summary|corrupt size vs. prev_size |__has_include evaluated
|and hang when using |even if disabled (with cpp
|__has_include with |in traditional-mode)
|-traditional-cpp |
Known to work| |9.3.0
--- Comment #2 from Tiziano Müller <dev-zero at gentoo dot org> ---
Since the ICE is gone in gcc-10.2, there is only the second issue left:
__has_include is evaluated even though it occurs in a "disabled region" when
running cpp in traditional mode. This breaks building some Fortran packages,
even when they guard the __has_include stmt with a `#if defined __has_include`
as per the documentation.
test2.h:
#if 0
#if (__has_include(<foo.h>))
#endif
#endif
$ ./install/gcc-10.2.0/bin/cpp -traditional-cpp test2.h
# 1 "test2.h"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 17 "/usr/include/stdc-predef.h" 3 4
# 32 "<command-line>" 2
# 1 "test2.h"
test2.h:3: error: operator "__has_include" requires a header-name
3 | #if (__has_include(<foo.h>))
|
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug preprocessor/95889] __has_include evaluated even if disabled (with cpp in traditional-mode)
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
2020-06-25 7:22 ` [Bug preprocessor/95889] " dev-zero at gentoo dot org
2020-07-24 10:34 ` [Bug preprocessor/95889] __has_include evaluated even if disabled (with cpp in traditional-mode) dev-zero at gentoo dot org
@ 2020-07-28 7:56 ` tm@dev-zero.ch
2020-07-29 8:13 ` [Bug preprocessor/95889] [10 regression] __has_include broken with -traditional-cpp (and therefore with Fortran) tm@dev-zero.ch
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tm@dev-zero.ch @ 2020-07-28 7:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
--- Comment #3 from Tiziano Müller <tm@dev-zero.ch> ---
Created attachment 48941
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48941&action=edit
fix __has_include with traditional-cpp
as posted on the gcc-patches ml
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug preprocessor/95889] [10 regression] __has_include broken with -traditional-cpp (and therefore with Fortran)
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
` (2 preceding siblings ...)
2020-07-28 7:56 ` tm@dev-zero.ch
@ 2020-07-29 8:13 ` tm@dev-zero.ch
2020-07-29 12:53 ` nathan at gcc dot gnu.org
2020-07-29 15:01 ` nathan at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: tm@dev-zero.ch @ 2020-07-29 8:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Tiziano Müller <tm@dev-zero.ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|__has_include evaluated |[10 regression]
|even if disabled (with cpp |__has_include broken with
|in traditional-mode) |-traditional-cpp (and
| |therefore with Fortran)
CC| |jakub at gcc dot gnu.org,
| |nathan at acm dot org
--- Comment #4 from Tiziano Müller <tm@dev-zero.ch> ---
Link to patch series here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550832.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug preprocessor/95889] [10 regression] __has_include broken with -traditional-cpp (and therefore with Fortran)
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
` (3 preceding siblings ...)
2020-07-29 8:13 ` [Bug preprocessor/95889] [10 regression] __has_include broken with -traditional-cpp (and therefore with Fortran) tm@dev-zero.ch
@ 2020-07-29 12:53 ` nathan at gcc dot gnu.org
2020-07-29 15:01 ` nathan at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-07-29 12:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org
Last reconfirmed| |2020-07-29
Status|UNCONFIRMED |ASSIGNED
CC| |nathan at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #5 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
thanks for the patch, taking so I don't forget
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug preprocessor/95889] [10 regression] __has_include broken with -traditional-cpp (and therefore with Fortran)
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
` (4 preceding siblings ...)
2020-07-29 12:53 ` nathan at gcc dot gnu.org
@ 2020-07-29 15:01 ` nathan at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-07-29 15:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95889
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Fixed trunk f6fe3bbf9f6
Fixed gcc-10 5e66b6c0103
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-29 15:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 7:06 [Bug preprocessor/95889] New: corrupt size vs. prev_size and hang when using __has_include with -traditional-cpp dev-zero at gentoo dot org
2020-06-25 7:22 ` [Bug preprocessor/95889] " dev-zero at gentoo dot org
2020-07-24 10:34 ` [Bug preprocessor/95889] __has_include evaluated even if disabled (with cpp in traditional-mode) dev-zero at gentoo dot org
2020-07-28 7:56 ` tm@dev-zero.ch
2020-07-29 8:13 ` [Bug preprocessor/95889] [10 regression] __has_include broken with -traditional-cpp (and therefore with Fortran) tm@dev-zero.ch
2020-07-29 12:53 ` nathan at gcc dot gnu.org
2020-07-29 15:01 ` nathan 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).