public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "moritz.klammler at cetitec dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/108099] New: ICE when parsing signed __int128_t typedef
Date: Wed, 14 Dec 2022 11:52:49 +0000	[thread overview]
Message-ID: <bug-108099-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108099
           Summary: ICE when parsing signed __int128_t typedef
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: moritz.klammler at cetitec dot com
  Target Milestone: ---

There seems to be a problem in the parser regarding typedefs involving
__int128_t prefixed with the signed keyword.

$ cat test.ii
using i128 = signed __int128_t;

$ g++ -v -c test.ii
Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/cc1plus -fpreprocessed test.ii -quiet
-dumpbase test.ii -dumpbase-ext .ii -mtune=generic -march=x86-64 -version -o
/tmp/ccn4pU5h.s
GNU C++17 (GCC) version 12.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version isl-0.25-GMP

warning: MPFR header version 4.1.0-p13 differs from library version 4.1.1-p1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (GCC) version 12.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version isl-0.25-GMP

warning: MPFR header version 4.1.0-p13 differs from library version 4.1.1-p1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 402ce889a414e2a3abbbe3146fa0a6cb
test.ii:1:21: internal compiler error: Segmentation fault
    1 | using i128 = signed __int128_t;
      |                     ^~~~~~~~~~
0x19eab38 internal_error(char const*, ...)
        ???:0
0x6f5f81 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ???:0
0x6fc532 groktypename(cp_decl_specifier_seq*, cp_declarator const*, bool)
        ???:0
0x7c7a9c c_parse_file()
        ???:0
0x8dcedd c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

Interestingly, std::make_signed_t<__int128_t> is compiled fine.

I have also tried a few variations in C and while a similar issue seems to
exist, no segfault happened.

$ cat test.i
typedef unsigned __int128_t number;
typedef   signed __int128_t number;

$ gcc -v -c test.i
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/cc1 -fpreprocessed test.i -quiet
-dumpbase test.i -dumpbase-ext .i -mtune=generic -march=x86-64 -version -o
/tmp/ccdh1Nyr.s
GNU C17 (GCC) version 12.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version isl-0.25-GMP

warning: MPFR header version 4.1.0-p13 differs from library version 4.1.1-p1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C17 (GCC) version 12.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version
4.1.0-p13, MPC version 1.2.1, isl version isl-0.25-GMP

warning: MPFR header version 4.1.0-p13 differs from library version 4.1.1-p1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4b798a352742e8322eaa4a166b8f6299
test.i:1:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘number’
    1 | typedef unsigned __int128_t number;
      |                             ^~~~~~
test.i:2:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘number’
    2 | typedef   signed __int128_t number;
      |                             ^~~~~~

I'm using GCC 12.2.0 as distributed with Archlinux on x86_64 GNU/Linux.

             reply	other threads:[~2022-12-14 11:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 11:52 moritz.klammler at cetitec dot com [this message]
2022-12-14 12:20 ` [Bug c++/108099] " redi at gcc dot gnu.org
2022-12-14 12:23 ` redi at gcc dot gnu.org
2022-12-14 12:26 ` redi at gcc dot gnu.org
2022-12-14 13:12 ` moritz.klammler at cetitec dot com
2022-12-14 17:46 ` [Bug c++/108099] ICE with type alias with `signed __int_128_t` pinskia at gcc dot gnu.org
2022-12-14 17:54 ` [Bug c++/108099] ICE with type alias with `signed __int128_t` pinskia at gcc dot gnu.org
2022-12-14 17:58 ` [Bug c++/108099] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-12-14 18:18 ` jakub at gcc dot gnu.org
2022-12-14 19:05 ` jakub at gcc dot gnu.org
2022-12-14 19:20 ` jakub at gcc dot gnu.org
2022-12-21 12:37 ` rguenth at gcc dot gnu.org
2022-12-21 18:14 ` ville.voutilainen at gmail dot com
2023-01-31 16:00 ` pinskia at gcc dot gnu.org
2023-02-01  0:51 ` pinskia at gcc dot gnu.org
2023-02-01 11:59 ` redi at gcc dot gnu.org
2023-02-01 19:07 ` pinskia at gcc dot gnu.org
2023-02-01 19:17 ` jakub at gcc dot gnu.org
2023-03-09 22:25 ` jason at gcc dot gnu.org
2023-03-10  3:57 ` cvs-commit at gcc dot gnu.org
2023-03-10  3:59 ` [Bug c++/108099] [12 " jason at gcc dot gnu.org
2023-03-10 10:33 ` jakub at gcc dot gnu.org
2023-04-18 20:45 ` cvs-commit at gcc dot gnu.org
2023-04-19 15:23 ` cvs-commit at gcc dot gnu.org
2023-04-19 16:53 ` cvs-commit at gcc dot gnu.org
2023-04-19 16:59 ` [Bug c++/108099] [12/13/14 " jason at gcc dot gnu.org
2023-04-20  7:44 ` cvs-commit at gcc dot gnu.org
2023-04-20  7:48 ` cvs-commit at gcc dot gnu.org
2023-04-21 19:33 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:25 ` [Bug c++/108099] [12/13 " cvs-commit at gcc dot gnu.org
2023-05-08 12:26 ` rguenth at gcc dot gnu.org
2023-07-25 10:50 ` [Bug c++/108099] [12 " redi at gcc dot gnu.org
2023-08-11 21:21 ` cvs-commit at gcc dot gnu.org
2023-12-19 21:50 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108099-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).