public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108099] New: ICE when parsing signed __int128_t typedef
@ 2022-12-14 11:52 moritz.klammler at cetitec dot com
  2022-12-14 12:20 ` [Bug c++/108099] " redi at gcc dot gnu.org
                   ` (32 more replies)
  0 siblings, 33 replies; 34+ messages in thread
From: moritz.klammler at cetitec dot com @ 2022-12-14 11:52 UTC (permalink / raw)
  To: gcc-bugs

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.

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

* [Bug c++/108099] ICE when parsing signed __int128_t typedef
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
@ 2022-12-14 12:20 ` redi at gcc dot gnu.org
  2022-12-14 12:23 ` redi at gcc dot gnu.org
                   ` (31 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-14 12:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
__int128_t is already a typedef, so you can't add a signed or unsigned
qualifier to it.

std::make_signed_t<__int128_t> works because that doesn't just add the 'signed'
keyword to it.

The keyword for the type is __int128 not __int128_t, so you can say signed
__int128 and unsigned __int128.

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

* [Bug c++/108099] ICE when parsing signed __int128_t typedef
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
  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
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-14 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|                            |2022-12-14
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> __int128_t is already a typedef, so you can't add a signed or unsigned
> qualifier to it.

i.e. the same reason this doesn't work:

using I = int;
signed I i = 0;

> std::make_signed_t<__int128_t> works because that doesn't just add the
> 'signed' keyword to it.

i.e. the same reason this works:

using I = int;
std::make_signed_t<I> i = 0;


It shouldn't ICE though.

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

* [Bug c++/108099] ICE when parsing signed __int128_t typedef
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
  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
                   ` (29 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-14 12:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> (In reply to Jonathan Wakely from comment #1)
> > __int128_t is already a typedef, so you can't add a signed or unsigned
> > qualifier to it.
> 
> i.e. the same reason this doesn't work:
> 
> using I = int;
> signed I i = 0;

Hmm, actually g++ *does* allow this, unless you use -pedantic-errors:

using I = int;
using II = signed I;

It's not valid C++ though.

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

* [Bug c++/108099] ICE when parsing signed __int128_t typedef
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (2 preceding siblings ...)
  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
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: moritz.klammler at cetitec dot com @ 2022-12-14 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Moritz Klammler <moritz.klammler at cetitec dot com> ---
I see, sorry for wasting your time. I forgot that there is a differently
spelled keyword in addition to the builtin(?) typedef. Since 'unsigned' got
accepted even with the typedef, it didn't occur to me now either...

A compiler error that's not a segfault sure would be nice but I shouldn't be
writing this borderline invalid code in the first place then.

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

* [Bug c++/108099] ICE with type alias with `signed __int_128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (3 preceding siblings ...)
  2022-12-14 13:12 ` moritz.klammler at cetitec dot com
@ 2022-12-14 17:46 ` 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
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-14 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE when parsing signed     |ICE with type alias with
                   |__int128_t typedef          |`signed __int_128_t`

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is interesting:
```
typedef __int128_t t;
using i128 = signed t;
//using i128_1 = signed __int128_t;
```
The above does not cause an ICE only a direct use of __int128_t causes the ICE
(with -pedantic we do warn about signed being used with the typedef though).

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

* [Bug c++/108099] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (4 preceding siblings ...)
  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 ` pinskia at gcc dot gnu.org
  2022-12-14 17:58 ` [Bug c++/108099] [12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-14 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I forgot to mention we do reject:
```
typedef signed __int128_t t;
```
already too.

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (5 preceding siblings ...)
  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 ` pinskia at gcc dot gnu.org
  2022-12-14 18:18 ` jakub at gcc dot gnu.org
                   ` (25 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-14 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.3.0
   Target Milestone|---                         |11.4
      Known to fail|                            |12.1.0
            Summary|ICE with type alias with    |[12/13 Regression] ICE with
                   |`signed __int128_t`         |type alias with `signed
                   |                            |__int128_t`

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The ICE is a regression from GCC 11 where we accepted the code with a pedwarn:
<source>:1:14: warning: 'signed' specified with '__int128' [-Wpedantic]
    1 | using i128 = signed __int128_t;
      |              ^~~~~~

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (6 preceding siblings ...)
  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
                   ` (24 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-14 18:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r12-8173-ge580f81d22d61153564959f08d9a6d3bcc7fd386
For
using u128 = unsigned __int128_t;
auto a = sizeof (u128);
it doesn't ICE but changes behavior, before that commit a was 16, now it is 4.
The reason for the ICE as well as 4 in there is because r12-8173 does:
+             type = DECL_ORIGINAL_TYPE (typedef_decl);
+             typedef_decl = NULL_TREE;
which is fine for user typedefs, but for the internally created typedefs like
__int128_t, __uint128_t, __builtin_va_list, dunno if others too
DECL_ORIGINAL_TYPE
is NULL.
So, the question is if we should fix it by tweaking c-common.cc so that instead
of say:
  if (targetm.scalar_mode_supported_p (TImode))
    lang_hooks.decls.pushdecl (build_decl (UNKNOWN_LOCATION,
                                           TYPE_DECL,
                                           get_identifier ("__int128_t"),
                                           intTI_type_node));
do
  if (targetm.scalar_mode_supported_p (TImode))
    {
      tree decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
                              get_identifier ("__int128_t"),
                              intTI_type_node);
      DECL_ORIGINAL_TYPE (decl) = intTI_type_node;
      lang_hooks.decls.pushdecl (decl);
    }
etc., or if it wouldn't be better or at least easier to:
--- gcc/cp/decl.cc.jj   2022-12-05 11:10:37.528674260 +0100
+++ gcc/cp/decl.cc      2022-12-14 19:16:40.242926374 +0100
@@ -12442,7 +12442,8 @@ grokdeclarator (const cp_declarator *dec
              pedwarn (loc, OPT_Wpedantic, "%qs specified with %qT",
                       key, type);
              ok = !flag_pedantic_errors;
-             type = DECL_ORIGINAL_TYPE (typedef_decl);
+             if (DECL_ORIGINAL_TYPE (typedef_decl))
+               type = DECL_ORIGINAL_TYPE (typedef_decl);
              typedef_decl = NULL_TREE;
            }
          else if (declspecs->decltype_p)
I'm going to test the latter.

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (7 preceding siblings ...)
  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
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-14 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Though, on
// PR c++/108099
// { dg-do compile { target c++11 } }
// { dg-options "" }

using u128 = unsigned __int128_t;
using s128 = signed __int128_t;
template <typename T, T v> struct integral_constant {
  static constexpr T value = v;
};
typedef integral_constant <bool, false> false_type;
typedef integral_constant <bool, true> true_type;
template <class T, class U>
struct is_same : false_type {};
template <class T>
struct is_same <T, T> : true_type {};
static_assert (is_same <__int128, s128>::value, "");
static_assert (is_same <signed __int128, s128>::value, "");
static_assert (is_same <__int128_t, s128>::value, "");
static_assert (is_same <unsigned __int128, u128>::value, "");
static_assert (is_same <__uint128_t, u128>::value, "");
static_assert (sizeof (s128) == sizeof (__int128), "");
static_assert (sizeof (u128) == sizeof (unsigned __int128), "");
static_assert (s128(-1) < 0, "");
static_assert (u128(-1) > 0, "");

in GCC 11 2 assertions failed (is_same with u128), while in trunk with the
above patch 3 assertions fail (also the
sizeof (u128) - u128 is then unsigned int rather than unsigned __int128.
No idea what we want for the is_same assertions, but I bet if we just pedwarn
on unsigned __int128_t and don't reject it, users would expect at least some
128-bit unsigned type.

Though, even on:
// PR c++/108099
// { dg-do compile { target c++11 } }
// { dg-options "" }

typedef long long t64;
using u64 = unsigned t64;
using s64 = signed t64;
template <typename T, T v> struct integral_constant {
  static constexpr T value = v;
};
typedef integral_constant <bool, false> false_type;
typedef integral_constant <bool, true> true_type;
template <class T, class U>
struct is_same : false_type {};
template <class T>
struct is_same <T, T> : true_type {};
static_assert (is_same <long long, s64>::value, "");
static_assert (is_same <signed long long, s64>::value, "");
static_assert (is_same <unsigned long long, u64>::value, "");
static_assert (sizeof (s64) == sizeof (long long), "");
static_assert (sizeof (u64) == sizeof (unsigned long long), "");
static_assert (s64(-1) < 0, "");
static_assert (u64(-1) > 0, "");

in GCC 11 only one assertion failed (is_same for u64), while in GCC 12 and
unpatched or patched trunk
2 of them fail (also the sizeof (u64) one).
So, it seems the r12-8173 change behavior not just for the builtin types, but
also for any other typedefs
(in the unsigned case).

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (8 preceding siblings ...)
  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
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-12-14 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Another question is what with this tolerated extension happens when the typedef
is unsigned.

// PR c++/108099
// { dg-do compile { target c++11 } }
// { dg-options "" }

typedef unsigned long long t64;
using u64 = unsigned t64;
using s64 = signed t64;
template <typename T, T v> struct integral_constant {
  static constexpr T value = v;
};
typedef integral_constant <bool, false> false_type;
typedef integral_constant <bool, true> true_type;
template <class T, class U>
struct is_same : false_type {};
template <class T>
struct is_same <T, T> : true_type {};
static_assert (is_same <long long, s64>::value, "");
static_assert (is_same <signed long long, s64>::value, "");
static_assert (is_same <unsigned long long, u64>::value, "");
static_assert (sizeof (s64) == sizeof (long long), "");
static_assert (sizeof (u64) == sizeof (unsigned long long), "");
static_assert (s64(-1) < 0, "");
static_assert (u64(-1) > 0, "");

shows 3 assertion failures, the 2 s64 is_same ones and s64(-1) < 0, so s64
was actually unsigned despite the signed keyword.
Trunk with the above patch shows 5 assertion failures, all 3 is_same, sizeof
(u64) and s64(-1) < 0.
If we don't want to error right away, either we should keep the gcc 11 and
earlier weirdo behavior, or better fix it such that with signed keyword and
unsigned typedef
we actually get corresponding unsigned type.  But in neither case using just
int/unsigned int if the type is wider or narrower.

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (9 preceding siblings ...)
  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
                   ` (21 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-21 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (10 preceding siblings ...)
  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
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: ville.voutilainen at gmail dot com @ 2022-12-21 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #11 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
More cases that ICE:

template <class> using AT = int;
using AA = AT<signed __int128_t>;

template <class> struct AT{};
using AA = AT<signed __int128_t>;

template <class> struct AT{};
AT<signed __int128_t> x;

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (11 preceding siblings ...)
  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
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-31 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mserdarsanli at gmail dot com

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 108613 has been marked as a duplicate of this bug. ***

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (12 preceding siblings ...)
  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
                   ` (18 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-01  0:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note it looks like type_traits uses this pattern. Though I am shocked it didn't
show up in testing ...

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (13 preceding siblings ...)
  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
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-01 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
$ g++ -E   -include type_traits -x c++ /dev/null | fgrep int128
    struct __is_integral_helper<__int128>
    struct __is_integral_helper<unsigned __int128>
   , signed __int128
   , unsigned __int128
    struct __make_unsigned<__int128>
    { typedef unsigned __int128 __type; };
    struct __make_signed<unsigned __int128>
    { typedef __int128 __type; };

Those are all correct. They don't use the __int128_t typedef, only the keyword.

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (14 preceding siblings ...)
  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
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-01 19:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #14)> 
> Those are all correct. They don't use the __int128_t typedef, only the
> keyword.

Then I wonder how someone got the reduced testcase from PR 108613 which used
__int128_t. Did they have a -D__int128=__int128_t somewhere?

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (15 preceding siblings ...)
  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
                   ` (15 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-02-01 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
  __extension__
  template<typename _Tp>
    using __is_signed_integer = __is_one_of<__remove_cv_t<_Tp>,
          signed char, signed short, signed int, signed long,
          signed long long
#if defined(__GLIBCXX_TYPE_INT_N_0)
          , signed __GLIBCXX_TYPE_INT_N_0
#endif
#if defined(__GLIBCXX_TYPE_INT_N_1)
          , signed __GLIBCXX_TYPE_INT_N_1
#endif
#if defined(__GLIBCXX_TYPE_INT_N_2)
          , signed __GLIBCXX_TYPE_INT_N_2
#endif
#if defined(__GLIBCXX_TYPE_INT_N_3)
          , signed __GLIBCXX_TYPE_INT_N_3
#endif
          >;
But at least for me
#define __GLIBCXX_TYPE_INT_N_0 __int128
and
              sprintf (buf, "__GLIBCXX_TYPE_INT_N_%d=__int%d", i,
int_n_data[i].bitsize);

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (16 preceding siblings ...)
  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
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-09 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (17 preceding siblings ...)
  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
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-10  3:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:2fc55f51f9953b451d6d6ddfae23379001e6ac95

commit r13-6569-g2fc55f51f9953b451d6d6ddfae23379001e6ac95
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Mar 9 17:35:24 2023 -0500

    c++: signed __int128_t [PR108099]

    The code for handling signed + typedef was breaking on __int128_t, because
    it isn't a proper typedef: it doesn't have DECL_ORIGINAL_TYPE.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-7.C: New test.

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (18 preceding siblings ...)
  2023-03-10  3:57 ` cvs-commit at gcc dot gnu.org
@ 2023-03-10  3:59 ` jason at gcc dot gnu.org
  2023-03-10 10:33 ` jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-10  3:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.0
            Summary|[12/13 Regression] ICE with |[12 Regression] ICE with
                   |type alias with `signed     |type alias with `signed
                   |__int128_t`                 |__int128_t`
   Target Milestone|11.4                        |12.3

--- Comment #18 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 13 so far.

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (19 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-10 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
What about the #c9 and #c10 testcases and questions on their behavior?
Defer that to GCC 14 as it isn't a regression?

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (20 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-18 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:32955c1c2246aa336d3fd2423c32546c39a6ca30

commit r12-9429-g32955c1c2246aa336d3fd2423c32546c39a6ca30
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Mar 9 17:35:24 2023 -0500

    c++: signed __int128_t [PR108099]

    The code for handling signed + typedef was breaking on __int128_t, because
    it isn't a proper typedef: it doesn't have DECL_ORIGINAL_TYPE.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-7.C: New test.

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (21 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-19 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:ed32ec26697cc77492d094b31a0d2eebc0535644

commit r14-88-ged32ec26697cc77492d094b31a0d2eebc0535644
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 18 17:12:17 2023 -0400

    c++: fix 'unsigned __int128_t' semantics [PR108099]

    My earlier patch for 108099 made us accept this non-standard pattern but
    messed up the semantics, so that e.g. unsigned __int128_t was not a 128-bit
    type.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Keep typedef_decl for __int128_t.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-8.C: New test.

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (22 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-19 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:7b30f13b904f137c77e5180357af7917a3b47af0

commit r12-9447-g7b30f13b904f137c77e5180357af7917a3b47af0
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 18 17:12:17 2023 -0400

    c++: fix 'unsigned __int128_t' semantics [PR108099]

    My earlier patch for 108099 made us accept this non-standard pattern but
    messed up the semantics, so that e.g. unsigned __int128_t was not a 128-bit
    type.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Keep typedef_decl for __int128_t.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-8.C: New test.

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

* [Bug c++/108099] [12/13/14 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (23 preceding siblings ...)
  2023-04-19 16:53 ` cvs-commit at gcc dot gnu.org
@ 2023-04-19 16:59 ` jason at gcc dot gnu.org
  2023-04-20  7:44 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: jason at gcc dot gnu.org @ 2023-04-19 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|13.0                        |
            Summary|[12 Regression] ICE with    |[12/13/14 Regression] ICE
                   |type alias with `signed     |with type alias with
                   |__int128_t`                 |`signed __int128_t`

--- Comment #23 from Jason Merrill <jason at gcc dot gnu.org> ---
The static_assert regressions from comment #9 and 10 demonstrate that this
issue isn't actually fixed yet.

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

* [Bug c++/108099] [12/13/14 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (24 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-20  7:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:bd4a1a547242a924663712ac7a13799433cdf476

commit r14-106-gbd4a1a547242a924663712ac7a13799433cdf476
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 20 09:43:04 2023 +0200

    testsuite: Fix up g++.dg/ext/int128-8.C testcase [PR109560]

    The testcase needs to be restricted to int128 effective targets,
    it expectedly fails on i386 and other 32-bit targets.

    2023-04-20  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108099
            PR testsuite/109560
            * g++.dg/ext/int128-8.C: Require int128 effective target.

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

* [Bug c++/108099] [12/13/14 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (25 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-20  7:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #25 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:3907147aa9bf51ae2bc5d8ddd5bf8d6ddfdf4bf5

commit r12-9449-g3907147aa9bf51ae2bc5d8ddd5bf8d6ddfdf4bf5
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Apr 20 09:43:04 2023 +0200

    testsuite: Fix up g++.dg/ext/int128-8.C testcase [PR109560]

    The testcase needs to be restricted to int128 effective targets,
    it expectedly fails on i386 and other 32-bit targets.

    2023-04-20  Jakub Jelinek  <jakub@redhat.com>

            PR c++/108099
            PR testsuite/109560
            * g++.dg/ext/int128-8.C: Require int128 effective target.

    (cherry picked from commit bd4a1a547242a924663712ac7a13799433cdf476)

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

* [Bug c++/108099] [12/13/14 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (26 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-21 19:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #26 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:03cebd304955a6b9c5607e09312d77f1307cc98e

commit r14-159-g03cebd304955a6b9c5607e09312d77f1307cc98e
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 18 21:32:07 2023 -0400

    c++: fix 'unsigned typedef-name' extension [PR108099]

    In the comments for PR108099 Jakub provided some testcases that
demonstrated
    that even before the regression noted in the patch we were getting the
    semantics of this extension wrong: in the unsigned case we weren't
producing
    the corresponding standard unsigned type but another distinct one of the
    same size, and in the signed case we were just dropping it on the floor and
    not actually returning a signed type at all.

    The former issue is fixed by using c_common_signed_or_unsigned_type instead
    of unsigned_type_for, and the latter issue by adding a (signed_p &&
    typedef_decl) case.

    This patch introduces a failure on std/ranges/iota/max_size_type.cc due to
    the latter issue, since the testcase expects 'signed rep_t' to do something
    sensible, and previously we didn't.  Now that we do, it exposes a bug in
the
    __max_diff_type::operator>>= handling of sign extension: when we evaluate
    -1000 >> 2 in __max_diff_type we keep the MSB set, but leave the
    second-most-significant bit cleared.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Don't clear typedef_decl after
'unsigned
            typedef' pedwarn.  Use c_common_signed_or_unsigned_type.  Also
            handle 'signed typedef'.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-8.C: Remove xfailed dg-bogus markers.
            * g++.dg/ext/unsigned-typedef2.C: New test.
            * g++.dg/ext/unsigned-typedef3.C: New test.

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (27 preceding siblings ...)
  2023-04-21 19:33 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 20:25 ` cvs-commit at gcc dot gnu.org
  2023-05-08 12:26 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:a713aa4f47ac1efbfe2338790b0b5e94a233fb99

commit r13-7277-ga713aa4f47ac1efbfe2338790b0b5e94a233fb99
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 18 21:32:07 2023 -0400

    c++: fix 'unsigned typedef-name' extension [PR108099]

    In the comments for PR108099 Jakub provided some testcases that
demonstrated
    that even before the regression noted in the patch we were getting the
    semantics of this extension wrong: in the unsigned case we weren't
producing
    the corresponding standard unsigned type but another distinct one of the
    same size, and in the signed case we were just dropping it on the floor and
    not actually returning a signed type at all.

    The former issue is fixed by using c_common_signed_or_unsigned_type instead
    of unsigned_type_for, and the latter issue by adding a (signed_p &&
    typedef_decl) case.

    This patch introduces a failure on std/ranges/iota/max_size_type.cc due to
    the latter issue, since the testcase expects 'signed rep_t' to do something
    sensible, and previously we didn't.  Now that we do, it exposes a bug in
the
    __max_diff_type::operator>>= handling of sign extension: when we evaluate
    -1000 >> 2 in __max_diff_type we keep the MSB set, but leave the
    second-most-significant bit cleared.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Don't clear typedef_decl after
'unsigned
            typedef' pedwarn.  Use c_common_signed_or_unsigned_type.  Also
            handle 'signed typedef'.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-8.C: New test.
            * g++.dg/ext/unsigned-typedef2.C: New test.
            * g++.dg/ext/unsigned-typedef3.C: New test.

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

* [Bug c++/108099] [12/13 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (28 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 34+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.3                        |12.4

--- Comment #28 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (29 preceding siblings ...)
  2023-05-08 12:26 ` rguenth at gcc dot gnu.org
@ 2023-07-25 10:50 ` 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
  32 siblings, 0 replies; 34+ messages in thread
From: redi at gcc dot gnu.org @ 2023-07-25 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |13958014620 at 139 dot com

--- Comment #29 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 110798 has been marked as a duplicate of this bug. ***

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (30 preceding siblings ...)
  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
  32 siblings, 0 replies; 34+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-11 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #30 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:50812881bbc1a78552682ae3a690bc0f512e762f

commit r12-9810-g50812881bbc1a78552682ae3a690bc0f512e762f
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 18 21:32:07 2023 -0400

    c++: fix 'unsigned typedef-name' extension [PR108099]

    In the comments for PR108099 Jakub provided some testcases that
demonstrated
    that even before the regression noted in the patch we were getting the
    semantics of this extension wrong: in the unsigned case we weren't
producing
    the corresponding standard unsigned type but another distinct one of the
    same size, and in the signed case we were just dropping it on the floor and
    not actually returning a signed type at all.

    The former issue is fixed by using c_common_signed_or_unsigned_type instead
    of unsigned_type_for, and the latter issue by adding a (signed_p &&
    typedef_decl) case.

    This patch introduces a failure on std/ranges/iota/max_size_type.cc due to
    the latter issue, since the testcase expects 'signed rep_t' to do something
    sensible, and previously we didn't.  Now that we do, it exposes a bug in
the
    __max_diff_type::operator>>= handling of sign extension: when we evaluate
    -1000 >> 2 in __max_diff_type we keep the MSB set, but leave the
    second-most-significant bit cleared.

            PR c++/108099

    gcc/cp/ChangeLog:

            * decl.cc (grokdeclarator): Don't clear typedef_decl after
'unsigned
            typedef' pedwarn.  Use c_common_signed_or_unsigned_type.  Also
            handle 'signed typedef'.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/int128-7.C: New test.
            * g++.dg/ext/int128-8.C: New test.
            * g++.dg/ext/unsigned-typedef2.C: New test.
            * g++.dg/ext/unsigned-typedef3.C: New test.

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

* [Bug c++/108099] [12 Regression] ICE with type alias with `signed __int128_t`
  2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
                   ` (31 preceding siblings ...)
  2023-08-11 21:21 ` cvs-commit at gcc dot gnu.org
@ 2023-12-19 21:50 ` jason at gcc dot gnu.org
  32 siblings, 0 replies; 34+ messages in thread
From: jason at gcc dot gnu.org @ 2023-12-19 21:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #31 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12.4/13.

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

end of thread, other threads:[~2023-12-19 21:50 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 11:52 [Bug c++/108099] New: ICE when parsing signed __int128_t typedef moritz.klammler at cetitec dot com
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

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).