public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context
@ 2020-06-20  6:26 evan@coeus-group.com
  2021-05-25  1:28 ` [Bug target/95782] " evan@coeus-group.com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: evan@coeus-group.com @ 2020-06-20  6:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95782
           Summary: [ppc64le] ICE in _cpp_pop_context
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: evan@coeus-group.com
  Target Milestone: ---

I'm running into an ICE on ppc64le:

  internal compiler error: in _cpp_pop_context, at libcpp/macro.c:2644

Here is a reproducer:

  #define a
  #define b(d) d
  #if defined(a)  
  b(vector double)
  #endif

Just running `gcc -E test.c` when targeting ppc64le triggers the issue.  It
happens with at least GCC 9 and 10.

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

* [Bug target/95782] [ppc64le] ICE in _cpp_pop_context
  2020-06-20  6:26 [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context evan@coeus-group.com
@ 2021-05-25  1:28 ` evan@coeus-group.com
  2024-03-26  6:58 ` [Bug target/95782] [s390] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: evan@coeus-group.com @ 2021-05-25  1:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Evan Nemerson <evan@coeus-group.com> ---
This seems to also happen on s390x with -mzvector:


# s390x-linux-gnu-gcc-10 -march=z14 -mzvector -o test test.c
test.c:4:1: internal compiler error: in _cpp_pop_context, at
libcpp/macro.c:2644
    4 | b(vector double)
      | ^
0x11da337 _cpp_pop_context
        ../../src/libcpp/macro.c:2644
0x11dcd67 expand_arg
        ../../src/libcpp/macro.c:2601
0x11dc41f replace_args
        ../../src/libcpp/macro.c:1879
0x11dc41f enter_macro_context
        ../../src/libcpp/macro.c:1421
0x11dc7e8 cpp_get_token_1
        ../../src/libcpp/macro.c:2891
0x6393fe c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
        ../../src/gcc/c-family/c-lex.c:458
0x5c96a5 c_lex_one_token
        ../../src/gcc/c/c-parser.c:270
0x5f6517 c_parser_peek_token(c_parser*)
        ../../src/gcc/c/c-parser.c:474
0x5f6517 c_parse_file()
        ../../src/gcc/c/c-parser.c:21742
0x64054b c_common_parse_file()
        ../../src/gcc/c-family/c-opts.c:1190
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

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

* [Bug target/95782] [s390] ICE in _cpp_pop_context
  2020-06-20  6:26 [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context evan@coeus-group.com
  2021-05-25  1:28 ` [Bug target/95782] " evan@coeus-group.com
@ 2024-03-26  6:58 ` pinskia at gcc dot gnu.org
  2024-03-26  6:58 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-26  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Target|powerpc64le                 |s390
   Target Milestone|---                         |13.0
             Status|UNCONFIRMED                 |NEW
      Known to work|13.1.0                      |
   Last reconfirmed|                            |2024-03-26
            Summary|[ppc64le] ICE in            |[s390] ICE in
                   |_cpp_pop_context            |_cpp_pop_context

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The powerpc issue was fixed in GCC 13 (most likely by
r13-220-g067fe66c8ba9b16feacf66fce9ae668091e42821 ).

s390 most likely needs the same treatment:
```
[apinski@xeond2 rs6000]$ git diff ../s390/s390-c.cc
diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 8d3d1a467a8..8096b1ff7c1 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -275,7 +275,7 @@ s390_macro_to_expand (cpp_reader *pfile, const cpp_token
*tok)
       /* __vector long __bool a; */
       if (ident == C_CPP_HASHNODE (__bool_keyword))
        expand_bool_p = true;
-      else
+      else if (ident)
        {
          /* Triggered with: __vector long long __bool a; */
          do

```

I cannot test this at all, and a similar testcase in PR 101168 should be added
for s390.

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

* [Bug target/95782] [s390] ICE in _cpp_pop_context
  2020-06-20  6:26 [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context evan@coeus-group.com
  2021-05-25  1:28 ` [Bug target/95782] " evan@coeus-group.com
  2024-03-26  6:58 ` [Bug target/95782] [s390] " pinskia at gcc dot gnu.org
@ 2024-03-26  6:58 ` pinskia at gcc dot gnu.org
  2024-03-27  6:11 ` guojiufu at gcc dot gnu.org
  2024-04-28  3:39 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-26  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |---

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

* [Bug target/95782] [s390] ICE in _cpp_pop_context
  2020-06-20  6:26 [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context evan@coeus-group.com
                   ` (2 preceding siblings ...)
  2024-03-26  6:58 ` pinskia at gcc dot gnu.org
@ 2024-03-27  6:11 ` guojiufu at gcc dot gnu.org
  2024-04-28  3:39 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2024-03-27  6:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jiu Fu Guo <guojiufu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |guojiufu at gcc dot gnu.org

--- Comment #3 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> The powerpc issue was fixed in GCC 13 (most likely by
> r13-220-g067fe66c8ba9b16feacf66fce9ae668091e42821 ).
> 
> s390 most likely needs the same treatment:
> ```
> [apinski@xeond2 rs6000]$ git diff ../s390/s390-c.cc
> diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
> index 8d3d1a467a8..8096b1ff7c1 100644
> --- a/gcc/config/s390/s390-c.cc
> +++ b/gcc/config/s390/s390-c.cc
> @@ -275,7 +275,7 @@ s390_macro_to_expand (cpp_reader *pfile, const cpp_token
> *tok)
>        /* __vector long __bool a; */
>        if (ident == C_CPP_HASHNODE (__bool_keyword))
>         expand_bool_p = true;
> -      else
> +      else if (ident)
>         {
>           /* Triggered with: __vector long long __bool a; */
>           do
> 
> ```
> 
> I cannot test this at all, and a similar testcase in PR 101168 should be
> added for s390.

Test with cross-compiling, this code can fix the issue as expected.

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

* [Bug target/95782] [s390] ICE in _cpp_pop_context
  2020-06-20  6:26 [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context evan@coeus-group.com
                   ` (3 preceding siblings ...)
  2024-03-27  6:11 ` guojiufu at gcc dot gnu.org
@ 2024-04-28  3:39 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-04-28  3:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jiu Fu Guo <guojiufu@gcc.gnu.org>:

https://gcc.gnu.org/g:83bc41e8364360b63eaa59c88e2fb499a6751233

commit r15-14-g83bc41e8364360b63eaa59c88e2fb499a6751233
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Wed Mar 27 14:15:40 2024 +0800

    s390: avoid peeking eof after __vector

    Same like PR101168, it is need for s390 to
    avoid peeking eof after vector keyword.
    And similar test case is also ok for s390.

            PR target/95782

    gcc/ChangeLog:

            * config/s390/s390-c.cc (s390_macro_to_expand): Avoid empty
identifier.

    gcc/testsuite/ChangeLog:

            * g++.target/s390/pr95782.C: New test.

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

end of thread, other threads:[~2024-04-28  3:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20  6:26 [Bug preprocessor/95782] New: [ppc64le] ICE in _cpp_pop_context evan@coeus-group.com
2021-05-25  1:28 ` [Bug target/95782] " evan@coeus-group.com
2024-03-26  6:58 ` [Bug target/95782] [s390] " pinskia at gcc dot gnu.org
2024-03-26  6:58 ` pinskia at gcc dot gnu.org
2024-03-27  6:11 ` guojiufu at gcc dot gnu.org
2024-04-28  3:39 ` cvs-commit 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).