[Bug c++/105696] invalid use of constexpr static class member accepted as constant expression

2022-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105696

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=92171

--- Comment #2 from Andrew Pinski  ---
Or is a dup of bug 92171.

[Bug c++/105696] invalid use of constexpr static class member accepted as constant expression

2022-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105696

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=79083

--- Comment #1 from Andrew Pinski  ---
I suspect this is basically the same as PR 79083.

[Bug c++/105696] New: invalid use of constexpr static class member accepted as constant expression

2022-05-22 Thread yiz152 at ucsd dot edu via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105696

Bug ID: 105696
   Summary: invalid use of constexpr static class member accepted
as constant expression
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yiz152 at ucsd dot edu
  Target Milestone: ---

Created attachment 53017
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53017=edit
Test case

G++ 12.1.0 accepts constexpr static class members referenced using class member
access syntax (see below/attached). The working draft states
(https://eel.is/c++draft/class.static#general-1) that in such cases, the object
expression (this->val) is evaluated, thereby breaking constexpr-ness (cf.
https://eel.is/c++draft/expr.const#5.1).

Compiled/tested with gcc 12.1.0, clang 13.0.1, -pedantic -Wall -Wextra
-std=c++1z. Also tested with -std=c++11,-std=c++14. Code/error (same as the
attached file):

#include 
struct A {
constexpr static int a = 17;
};

struct B {
A val;
int foo() {
// gcc compiles without warning; clang rejects
return std::integral_constant::value;
}
int good_foo() {
// gcc compiles without warning, correct
return std::integral_constant::value;
}
void bar() {
char a[val.a]; // gcc compiles without warning, clang warns -Wvla
(void) a;
}
void var_bar(int len) {
char a[len]; // gcc compiles with -Wvla, clang does as well
(void) a;
}
};

int main() {}


gcc -v:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --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-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-linker-build-id --enable-lto
--enable-multilib --enable-plugin --enable-shared --enable-threads=posix
--disable-libssp --disable-libstdcxx-pch --disable-werror
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)

[Bug libcc1/105695] GCC 10.3.1 (20220519) build failure with GCC 12

2022-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695

--- Comment #1 from Andrew Pinski  ---
The problem is -std=gnu++98 I think.

[Bug libcc1/105695] New: GCC 10.3.1 (20220519) build failure with GCC 12

2022-05-22 Thread sam at gentoo dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695

Bug ID: 105695
   Summary: GCC 10.3.1 (20220519) build failure with GCC 12
   Product: gcc
   Version: 10.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libcc1
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sam at gentoo dot org
  Target Milestone: ---

Created attachment 53016
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53016=edit
build.log.xz

```
/bin/bash ./libtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++
-std=gnu++98 -DHAVE_CONFIG_H -I.
-I/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1
 -I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../include
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../libgcc
-I ../gcc
-I/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/c-family
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../libcpp/include
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/c
  -W -Wall  -fvisibility=hidden  -pipe -march=native -fdiagnostics-color=always
-D_GLIBCXX_ASSERTIONS -ggdb3 -O2 -MT libcc1plugin.lo -MD -MP -MF
.deps/libcc1plugin.Tpo -c -o libcc1plugin.lo
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/libcc1plugin.cc
libtool: compile:  x86_64-pc-linux-gnu-g++ -std=gnu++98 -DHAVE_CONFIG_H -I.
-I/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../include
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../libgcc
-I ../gcc
-I/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/c-family
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../libcpp/include
-I
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/c
-W -Wall -fvisibility=hidden -pipe -march=native -fdiagnostics-color=always
-D_GLIBCXX_ASSERTIONS -ggdb3 -O2 -MT libcc1plugin.lo -MD -MP -MF
.deps/libcc1plugin.Tpo -c
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/libcc1plugin.cc
 -fPIC -DPIC -o .libs/libcc1plugin.o
In file included from
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/hash-table.h:248,
 from
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/coretypes.h:461,
 from
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/gcc-plugin.h:29,
 from
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/libcc1plugin.cc:34:
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/vec.h:
In member function ‘void vec::reverse()’:
/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/gcc-10-20220519/libcc1/../gcc/vec.h:2086:10:
error: ‘swap’ is not a member of ‘std’
 2086 | std::swap (ptr[i], ptr[l - i - 1]);
  |  ^~~~
make[2]: *** [Makefile:600: libcc1plugin.lo] Error 1
make[2]: Leaving directory
'/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/build/libcc1'
make[1]: *** [Makefile:14552: install-libcc1] Error 2
make[1]: Leaving directory
'/var/tmp/portage.notmp/portage/sys-devel/gcc-10.3.1_p20220519/work/build'
make: *** [Makefile:2438: install] Error 2
 * ERROR: sys-devel/gcc-10.3.1_p20220519::gentoo failed (install phase):
```

I've attached the full log (xz compressed b/c of size).

```
$ gcc --version
gcc (Gentoo Hardened 12.1.1_p20220521 p5) 12.1.1 20220521
Copyright (C) 2022 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.
```

[Bug c++/105694] New: ICE: in finish_expr_stmt, at cp/semantics.cc:892

2022-05-22 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105694

Bug ID: 105694
   Summary: ICE: in finish_expr_stmt, at cp/semantics.cc:892
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

11.3 Regression

#include 

int main() {
  std::apply([](auto...) {
[](std::index_sequence) {
  ([](auto... tuples) {
(std::get(tuples), ...);
  }(I), ...);
}(std::make_index_sequence<3>{});
  }, std::tuple(1, 2, 3.0));
}

https://godbolt.org/z/KPorc1fnK

[Bug c++/105693] New: Requires-clause constructor is not selected

2022-05-22 Thread fchelnokov at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105693

Bug ID: 105693
   Summary: Requires-clause constructor is not selected
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

In the following program struct template A has deleted default constructor for
T=int:

#include 

template
struct A {
A() = default;
A() requires (std::same_as) = delete;
};

A a;

The program is rejected by Clang and MSVC, but not by GCC. Demo:
https://gcc.godbolt.org/z/G7T5xv35q

[Bug fortran/105691] Incorrect calculation of INDEX(str1,str2) at compile time

2022-05-22 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105691

--- Comment #3 from kargl at gcc dot gnu.org ---
There is no need to special case the substring length of 1 case with my
suggested patch.  Here's an update to eliminate the special case.

diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index 233cc42137f..fa9938d6a1e 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -3589,49 +3589,31 @@ gfc_simplify_index (gfc_expr *x, gfc_expr *y, gfc_expr
*b, gfc_expr *kind)
  mpz_set_si (result->value.integer, len + 1);
  return result;
}
-  else if (lensub == 1)
+  else
{
- for (i = 0; i < len; i++)
+ /* Start at the tail of the string, offset by the length of the
+substring, and search for a match moving towards the head of
+string.  */
+ for (i = len - lensub; i >= 0; i--)
{
- for (j = 0; j < lensub; j++)
+ /* If the first character does not match, then the rest of the
+string cannot match.  */
+ if (x->value.character.string[i]
+ == y->value.character.string[0])
{
- if (y->value.character.string[j]
- == x->value.character.string[len - i])
+
+ /* Compare substring to starting location in string.  */  
+ for (j = 0, count = 0; j < lensub; j++, count++)
{
- index = len - i + 1;
- goto done;
+ if (x->value.character.string[i + j]
+ != y->value.character.string[j])
+   break;
}
-   }
-   }
-   }
-  else
-   {
- for (i = 0; i < len; i++)
-   {
- for (j = 0; j < lensub; j++)
-   {
- if (y->value.character.string[j]
- == x->value.character.string[len - i])
+
+ if (count == lensub)
{
- start = len - i;
- if (start <= len - lensub)
-   {
- count = 0;
- for (k = 0; k < lensub; k++)
-   if (y->value.character.string[k]
-   == x->value.character.string[k + start])
- count++;
-
- if (count == lensub)
-   {
- index = start + 1;
- goto done;
-   }
-   }
- else
-   {
- continue;
-   }
+ index = i + 1;
+ goto done;
}
}
}

[Bug fortran/105691] Incorrect calculation of INDEX(str1,str2) at compile time

2022-05-22 Thread kargl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105691

kargl at gcc dot gnu.org changed:

   What|Removed |Added

   Last reconfirmed||2022-05-22
 CC||kargl at gcc dot gnu.org
 Ever confirmed|0   |1
   Priority|P3  |P4
 Status|UNCONFIRMED |NEW

--- Comment #2 from kargl at gcc dot gnu.org ---
There is some torched logic looking for the substring, which can never find it.

diff --git a/gcc/fortran/simplify.cc b/gcc/fortran/simplify.cc
index 233cc42137f..16b231f5707 100644
--- a/gcc/fortran/simplify.cc
+++ b/gcc/fortran/simplify.cc
@@ -3606,32 +3606,29 @@ gfc_simplify_index (gfc_expr *x, gfc_expr *y, gfc_expr
*b, gfc_expr *kind)
}
   else
{
- for (i = 0; i < len; i++)
+ /* Start at the tail of the string, offset by the length of the
+substring, and search for a match moving towards the head of
+string.  */
+ for (i = len - lensub; i >= 0; i--)
{
- for (j = 0; j < lensub; j++)
+ /* If the first character does not match, then the rest of the
+string cannot match.  */
+ if (x->value.character.string[i]
+ == y->value.character.string[0])
{
- if (y->value.character.string[j]
- == x->value.character.string[len - i])
+
+ /* Compare substring to starting location in string.  */  
+ for (j = 0, count = 0; j < lensub; j++, count++)
{
- start = len - i;
- if (start <= len - lensub)
-   {
- count = 0;
- for (k = 0; k < lensub; k++)
-   if (y->value.character.string[k]
-   == x->value.character.string[k + start])
- count++;
-
- if (count == lensub)
-   {
- index = start + 1;
- goto done;
-   }
-   }
- else
-   {
- continue;
-   }
+ if (x->value.character.string[i + j]
+ != y->value.character.string[j])
+   break;
+   }
+
+ if (count == lensub)
+   {
+ index = i + 1;
+ goto done;
}
}
}

[Bug c++/104230] Non-type template arguments of reference and pointer type fail when initialized by pointer to member operator

2022-05-22 Thread anton at socialhacker dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104230

--- Comment #3 from anton at socialhacker dot com ---
I've found the relevant discussion about the correct way to mangle subobject
references in template parameters here:

https://github.com/itanium-cxx-abi/cxx-abi/issues/47

It looks like Clang already has this implemented.  but I'm not sure which
version of the compiler has the referenced commits.

[Bug c++/105692] New: internal compiler error: in finish_expr_stmt, at cp/semantics.cc:872

2022-05-22 Thread elmar.braun at web dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105692

Bug ID: 105692
   Summary: internal compiler error: in finish_expr_stmt, at
cp/semantics.cc:872
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: elmar.braun at web dot de
  Target Milestone: ---

Created attachment 53015
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53015=edit
output of compiling with -freport-bug

Reduced testcase:

  template 
  using lambda = decltype([] {});

  template 
  void f3() {}

  template 
  void f2() {
f3>();
  }

  void f1() {
f2();
  }

Compiling this with GCC 12.1.0, using the command line "g++-12.1 -std=c++20
-Wall -Wextra bug.cpp", results in the following error message:

  bug.cpp: In instantiation of ‘void f2() [with T = int]’:
  bug.cpp:13:10:   required from here
  bug.cpp:9:3: internal compiler error: in finish_expr_stmt, at
cp/semantics.cc:872
  9 |   f3>();

Exact version of GCC, system type, and options given when GCC was configured
can be found in the attached output from -freport-bug.

I was also able to reproduce the issue on godbolt.org
(https://godbolt.org/z/3344WMcWT). Clang 14 and the latest MSVC compile this
code without problems.

[Bug libstdc++/105681] libstdc++-v3 fails to build on msp430

2022-05-22 Thread mikpelinux at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105681

Mikael Pettersson  changed:

   What|Removed |Added

 CC||mikpelinux at gmail dot com

--- Comment #3 from Mikael Pettersson  ---
I can reproduce in a cross to --target=msp430-unknown-elf
--enable-languages=c,c++ with binutils-2.38 and newlib-4.2.0.20211231.
gcc-11.3.0 builds fine, but gcc-12.1.0 build fails with

In file included from
/mnt/scratch/cross/sources/gcc-12.1.0/libstdc++-v3/include/precompiled/extc++.h:61:
/mnt/scratch/cross/objdir-gcc/msp430-unknown-elf/libstdc++-v3/include/ext/random:355:69:
error: narrowing conversion of '86243' from 'long int' to 'unsigned int'
[-Wnarrowing]
  355 | 0xU, 0xe9528d85U>
  | ^
(several more)

and

In file included from
/mnt/scratch/cross/objdir-gcc/msp430-unknown-elf/libstdc++-v3/include/ext/pb_ds/hash_policy.hpp:475,
 from
/mnt/scratch/cross/objdir-gcc/msp430-unknown-elf/libstdc++-v3/include/ext/pb_ds/detail/standard_policies.hpp:45,
 from
/mnt/scratch/cross/objdir-gcc/msp430-unknown-elf/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp:47,
 from
/mnt/scratch/cross/sources/gcc-12.1.0/libstdc++-v3/include/precompiled/extc++.h:72:
/mnt/scratch/cross/objdir-gcc/msp430-unknown-elf/libstdc++-v3/include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp:73:32:
error: narrowing conversion of '116731' from 'long unsigned int' to
'std::size_t' {aka 'unsigned int'} [-Wnarrowing]
   73 |   /* 14*/  116731ul,
  |^~~~
(many more)

[Bug ada/100486] Ada build fails for 32bit Windows

2022-05-22 Thread charlet at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100486

--- Comment #74 from Arnaud Charlet  ---
The patch is desirable even outside of this PR, so we'll keep it. And as shown
by PR105507, we have other exception propagation that crept in unintentionally,
so I'll also have a look at these when I get a chance.

[Bug ada/100486] Ada build fails for 32bit Windows

2022-05-22 Thread reiter.christoph at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100486

--- Comment #73 from Christoph Reiter  ---
In a similar bug 105507 we figured out that the MSYS2 build was broken because
it was linking libgcc both statically and dynamically via dependencies, and
that breaks exceptions with dwarf-2.

So in theory the above patch could be reverted. I can try building with it
being reverted to confirm, if wanted.

[Bug ada/105507] Ada build fails for 32bit Windows

2022-05-22 Thread reiter.christoph at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105507

Christoph Reiter  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #11 from Christoph Reiter  ---
I went with --with-boot-ldflags="-static-libstdc++" and
--with-stage1-ldflags="-static-libstdc++" now, and everything works nicely.

Thanks for your help and insight.

I'll document the dwarf-2 limitation downstream, so this hopefully wont happen
again.

[Bug fortran/105691] Incorrect calculation of INDEX(str1,str2) at compile time

2022-05-22 Thread xecej4 at outlook dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105691

--- Comment #1 from mecej4  ---
When a program contains an expression that involves the INDEX intrinsic
function, and it is possible to calculate its result value at compile time, the
computed value is sometimes incorrect.

program main
   i = index("fortran.f90", "fortran", back=.true.) ! It should get '1'
   call prnt(i)
contains
   subroutine prnt(i)
   integer i
   print *,'i = ',i
   end subroutine
end program

The program prints '0' instead of '1'. Looking at the assembly code generated
shows that the argument value in the argument I passed to PRNT() is zero.

[Bug fortran/105691] New: Incorrect calculation of INDEX(str1,str2) at compile time

2022-05-22 Thread xecej4 at outlook dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105691

Bug ID: 105691
   Summary: Incorrect calculation of INDEX(str1,str2) at compile
time
   Product: gcc
   Version: 11.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: xecej4 at outlook dot com
  Target Milestone: ---

[Bug c/105690] New: -Warray-bounds sensitive false positive with -O2

2022-05-22 Thread sirl at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105690

Bug ID: 105690
   Summary: -Warray-bounds sensitive false positive with -O2
   Product: gcc
   Version: 12.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sirl at gcc dot gnu.org
  Target Milestone: ---

Hi,

this minimized testcase issues

# gcc-12 -O2 -Warray-bounds -c testcase.c
testcase.c: In function 'fun3.part.0':
testcase.c:16:13: warning: array subscript [0, 19] is outside array bounds of
'table_t[20]' [-Warray-bounds=]
   16 |   if (gtable[idx].mode)
  |   ~~^
testcase.c:8:9: note: while referencing 'gtable'
8 | table_t gtable[20];
  | ^~

with target linux-x86_64. It happens with gcc-12@r12-r8405 or
gcc-trunk@r13-555. The testcase is quite sensitive, even choosing a buffer size
smaller than 257 stops the warning. With gcc-7 to gcc-11 I don't get the
warning.

int gvar1;
void fun1(int, char *, int);
void fun2(int, char *);
typedef struct {
  int exist;
  int mode;
} table_t;
table_t gtable[20];

void fun3(int idx)
{
  char buffer[257];
  if (idx < 0 || idx >= 20 || gtable[idx].exist == 0)
return;
  fun2(idx, buffer);
  if (gtable[idx].mode)
fun2(idx, buffer);
}

void fun4()
{
  fun3(gvar1);
}

int fun2_maxlen;
void fun2(int idx, char * text)
{
  if (!(idx < 0 || idx >= 20 || gtable[idx].exist == 0))
fun1(idx, text, fun2_maxlen);
}

[Bug c/105688] Cannot build GCC 11.3 on Fedora 36

2022-05-22 Thread aros at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105688

--- Comment #5 from Artem S. Tashkinov  ---
Using the official tar.xz file of course, without any
changes/modifications/patches.

[Bug c/105688] Cannot build GCC 11.3 on Fedora 36

2022-05-22 Thread aros at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105688

--- Comment #4 from Artem S. Tashkinov  ---
(In reply to Andrew Pinski from comment #3)
> How are you building gcc?
> What configure options are being passed?
> What make options are being passed?
> Do you have any env variables set that might effect configure/make?
> Are you building in the source directory or a different directory?

#! /bin/sh

WD=/tmp/OBJDIR
GD=`pwd`

export CFLAGS="-O2 -pipe -mtune=generic"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-Wl,-O1"

mkdir -p "$WD" && cd "$WD" && \
"$GD"/configure --disable-stage1-checking --with-system-zlib \
--enable-languages="c,c++,lto" --prefix=/opt/gcc \
--disable-sjlj-exceptions --enable-newlib-io-long-long \
--with-gcc-major-version-only --without-isl --enable-multilib

nice make -j16

[Bug c/105688] Cannot build GCC 11.3 on Fedora 36

2022-05-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105688

Andrew Pinski  changed:

   What|Removed |Added

   Last reconfirmed||2022-05-22
 Ever confirmed|0   |1
 Status|UNCONFIRMED |WAITING

--- Comment #3 from Andrew Pinski  ---
How are you building gcc?
What configure options are being passed?
What make options are being passed?
Do you have any env variables set that might effect configure/make?
Are you building in the source directory or a different directory?

[Bug c/105675] Segmentation fault

2022-05-22 Thread watarai775 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105675

--- Comment #4 from Ruslan Mkoyan  ---
(In reply to Andrew Pinski from comment #3)
> This is a won't fix stitutation. 
> 
> You have & on a type repeated 237,679 times. 
> 
> With a recusive decent compiler, you run out of stack space with that many
> times.
> #17 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #18 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #19 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #20 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #21 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #22 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #23 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #24 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #25 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #26 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #27 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #28 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #29 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #30 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #31 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #32 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at /home/apinski/src/upstream-gcc/gcc/gcc/cp/parser.cc:22948
> #33 0x00b7c653 in cp_parser_declarator (parser=0x772bd7b8,
> dcl_kind=CP_PARSER_DECLARATOR_NAMED, flags=0, ctor_dtor_or_conv_p=0x0,
> parenthesized_p=, member_p=false, friend_p=false,
> static_p=false) at 

[Bug c/105689] New: Bogus `-Wstringop-overflow=` after accessing field, then containing struct (wrong "region size")

2022-05-22 Thread sagebar at web dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105689

Bug ID: 105689
   Summary: Bogus `-Wstringop-overflow=` after accessing field,
then containing struct (wrong "region size")
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sagebar at web dot de
  Target Milestone: ---

The following code wrongly produces a warning `[-Wstringop-overflow=`:

Compile (using `gcc -c -O2 infile.c`)

```
struct subobject {
int field1;
int field2;
};

struct myobject {
struct subobject sub;
};

extern void access_1(int *a);
extern __attribute__((access(read_write, 1))) void access_2(struct subobject
*);

void myfunc(struct myobject *me) {
// { void *p __attribute__((unused)) = >sub; }
access_1(>sub.field1);
access_2(>sub);
}
```

=== Output (gcc-12) ===
>infile.c: In function 'myfunc':
>infile.c:16:9: warning: 'access_2' accessing 8 bytes in a region of size 4 
>[-Wstringop-overflow=]
>   16 | access_2(>sub);
>  | ^~
>infile.c:11:52: note: in a call to function 'access_2' declared with attribute 
>'access (read_write, 1)'
>   11 | extern __attribute__((access(read_write, 1))) void access_2(struct 
> subobject *);
>  |^~~~

=== Output (expected) ===
>


=== Notes ===

- By uncommenting the line `{ void *p __attribute__((unused)) = >sub; }`,
the warning goes away, even though that line literally does nothing. (see
Theory below)
- I was able to observe this bug in gcc-12.1.0 and gcc-11.2.0


=== Theory ===

It seems that this has got something to do with some internal, hidden attribute
(relating to the "region size") attached to some field-expression the first
time that field is accessed, only that when accessing `me->sub.field1` (where
`offsetof(field1) == 0`) before `me->sub`, that "region size" attribute
wrongfully also gets attached to `me->sub`. Then, when an access to `me->sub`
actually happens, gcc seems to think that the "region size" of `me->sub` as a
whole matches the size of the previously accessed field (`me->sub.field1`).

This seems further compounded by the fact that this only happens when `field1`
is the first field of `subobject` (i.e. has offset 0). If we insert another
field `int field0;` before it, the warning also disappears (so something in
gcc's logic appears to make it think that `region_size_of()
== region_size_of()`)

[Bug c/105688] Cannot build GCC 11.3 on Fedora 36

2022-05-22 Thread aros at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105688

--- Comment #2 from Artem S. Tashkinov  ---
This workaround of mine is not really good: after `make install` you end up
with /opt/gcc/lib64/libstdc++.so.6.0.29 which is not GCC's but the system one
(/usr/lib64/libstdc++.so.6.0.30.so).

[Bug c/105688] Cannot build GCC 11.3 on Fedora 36

2022-05-22 Thread aros at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105688

--- Comment #1 from Artem S. Tashkinov  ---
In /tmp/OBJDIR/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs I replaced the built
libstdc++.so.29 _three times_ with the system one (libstdc++.so.30) and it all
worked.

Still this looks like a serious bug which is worth resolving.

Google doesn't find anything relevant, so people may get stuck.

[Bug c/105688] New: Cannot build GCC 11.3 on Fedora 36

2022-05-22 Thread aros at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105688

Bug ID: 105688
   Summary: Cannot build GCC 11.3 on Fedora 36
   Product: gcc
   Version: 11.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: aros at gmx dot com
  Target Milestone: ---

When trying to make gcc-11.3.0.tar.xz:

/bin/sh /tmp/gcc-11.3.0/libgcc/../mkinstalldirs 32
/tmp/OBJDIR/./gcc/xgcc -B/tmp/OBJDIR/./gcc/ -B/opt/gcc/x86_64-pc-linux-gnu/bin/
-B/opt/gcc/x86_64-pc-linux-gnu/lib/ -isystem
/opt/gcc/x86_64-pc-linux-gnu/include -isystem
/opt/gcc/x86_64-pc-linux-gnu/sys-include   -fno-checking -O2  -g -O2 -pipe
-mtune=generic -DIN_GCC-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wno-error=format-diag -Wno-format -Wstrict-prototypes -Wmissing-prototypes
-Wno-error=format-diag -Wold-style-definition  -isystem ./include  -fpic
-mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector  -shared -nodefaultlibs
-Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o
32/libgcc_s.so.1.tmp -g -O2 -pipe -mtune=generic -m32 -B./ _muldi3_s.o
_negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o
_clear_cache_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o
_addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o
_negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o
_clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o
_popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o
_powidf2_s.o _powixf2_s.o _powitf2_s.o _mulhc3_s.o _mulsc3_s.o _muldc3_s.o
_mulxc3_s.o _multc3_s.o _divhc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o
_divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _clrsbsi2_s.o _clrsbdi2_s.o
_fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o
_fixxfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _floatdisf_s.o
_floatdidf_s.o _floatdixf_s.o _floatundisf_s.o _floatundidf_s.o
_floatundixf_s.o _divdi3_s.o _moddi3_s.o _divmoddi4_s.o _udivdi3_s.o
_umoddi3_s.o _udivmoddi4_s.o _udiv_w_sdiv_s.o cpuinfo_s.o tf-signs_s.o
sfp-exceptions_s.o addtf3_s.o divtf3_s.o eqtf2_s.o getf2_s.o letf2_s.o
multf3_s.o negtf2_s.o subtf3_s.o unordtf2_s.o fixtfsi_s.o fixunstfsi_s.o
floatsitf_s.o floatunsitf_s.o fixtfdi_s.o fixunstfdi_s.o floatditf_s.o
floatunditf_s.o extendsftf2_s.o extenddftf2_s.o extendxftf2_s.o trunctfsf2_s.o
trunctfdf2_s.o trunctfxf2_s.o enable-execute-stack_s.o unwind-dw2_s.o
unwind-dw2-fde-dip_s.o unwind-sjlj_s.o unwind-c_s.o emutls_s.o libgcc.a -lc &&
rm -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1
32/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp
32/libgcc_s.so.1 && (echo "/* GNU ld script"; echo "   Use the shared library,
but some functions are only in"; echo "   the static library.  */"; echo "GROUP
( libgcc_s.so.1 -lgcc )" ) > 32/libgcc_s.so
/usr/bin/ld:
/tmp/OBJDIR/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version
`GLIBCXX_3.4.30' not found (required by /usr/bin/ld)
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:995: libgcc_s.so] Error 1

I've no idea what to, please help.

[Bug libstdc++/105681] libstdc++-v3 fails to build on msp430

2022-05-22 Thread beagleboard at davidjohnsummers dot uk via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105681

--- Comment #2 from David Summers  ---
I suspect its the newlib includes that trigger the problem. As it I did one
compile, where the configure grabbed the host includes (and 64bit system); and
that compile I think worked fine.

My problem though, as my target is a small 16bit cpu, I need the smallest
library, and newlib nano seems to work well - so that will be the library on
the machine where the code is run ..,

[Bug fortran/105687] New: non-contiguous data in assumed rank

2022-05-22 Thread martin.diehl at kuleuven dot be via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105687

Bug ID: 105687
   Summary: non-contiguous data in assumed rank
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: martin.diehl at kuleuven dot be
  Target Milestone: ---

Created attachment 53014
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53014=edit
small reproducer

When passing a strided array to a select-rank statement, the information that
that data is non-contiguous is somehow lost. At least when further passing the
data to an assumed-size function, the arriving data differs.

Note: This might be related to bug 105674. This report illustrates the actual
problem I've encountered (wrong data) while the other report shows intermediate
results when trying to write a minimal reproducer.


code

program test

  integer, dimension(2,2), target :: dim_2
  integer, dimension(:,:), pointer :: strided
  integer :: i

  dim_2 = reshape([(i,i=1,size(dim_2))],shape(dim_2))
  strided => dim_2(1:1,:)

  print*, 'is_contiguous(strided)', is_contiguous(strided)
  print*, 'is_contiguous((strided))', is_contiguous((strided))
  print*, ''

  print*, 'call show(strided)'
  call show(strided,size(strided))
  print*, 'call show((strided))'
  call show((strided),size((strided)))
  print*, 'call assumed_rank(strided)'
  call assumed_rank(strided)
  print*, 'call assumed_rank((strided))'
  call assumed_rank((strided))

  contains

  subroutine assumed_rank(dataset)

integer, intent(in), dimension(..) :: dataset

select rank(dataset)
  rank(2)
print*, 'is contiguous in select', is_contiguous(dataset)
print*, 'data in select', dataset
call show(dataset,size(dataset))
end select

print*, ''

  end subroutine assumed_rank

  subroutine show(dataset,s)

integer, intent(in) :: s
integer, intent(in), dimension(*) :: dataset

print*, 'is contiguous in show', is_contiguous(dataset)
print*, 'data in show', dataset(1:s)
print*, ''

  end subroutine show

end program test

output
==
 is_contiguous(strided) F
 is_contiguous((strided)) T

 call show(strided)
 is contiguous in show T
 data in show   1   3

 call show((strided))
 is contiguous in show T
 data in show   1   3

 call assumed_rank(strided)
 is contiguous in select T
 data in select   1   3
 is contiguous in show T
 data in show   1   2


 call assumed_rank((strided))
 is contiguous in select T
 data in select   1   3
 is contiguous in show T
 data in show   1   3

[Bug sanitizer/105614] mips64: sanitizer_platform_limits_linux.cpp:75:38: error: static assertion failed

2022-05-22 Thread judge.packham at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105614

--- Comment #8 from Chris Packham  ---
In terms of my proposed change which fixes the problem for GCC 11.3.0 it
actually triggers the same assert on GCC 12.1.0.


[ALL  ]In file included from
/home/bagas/cross/workdir/mips64-unknown/.build/mips64-unknown-linux-gnu/src/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:21:
[ERROR]   
/home/bagas/cross/workdir/mips64-unknown/.build/mips64-unknown-linux-gnu/src/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:75:38:
error: static assertion failed
[ALL  ]   75 | COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct
stat));
[ALL  ]  |~~^~
[ALL  ]   
/home/bagas/cross/workdir/mips64-unknown/.build/mips64-unknown-linux-gnu/src/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44:
note: in definition of macro 'COMPILER_CHECK'
[ALL  ]  348 | #define COMPILER_CHECK(pred) static_assert(pred, "")
[ALL  ]  |^~~~
[ALL  ]   
/home/bagas/cross/workdir/mips64-unknown/.build/mips64-unknown-linux-gnu/src/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cpp:75:38:
note: the comparison reduces to '(104 == 216)'
[ALL  ]   75 | COMPILER_CHECK(struct_kernel_stat_sz == sizeof(struct
stat));
[ALL  ]  |~~^~
[ALL  ]   
/home/bagas/cross/workdir/mips64-unknown/.build/mips64-unknown-linux-gnu/src/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:348:44:
note: in definition of macro 'COMPILER_CHECK'
[ALL  ]  348 | #define COMPILER_CHECK(pred) static_assert(pred, "")
[ALL  ]  |^~~~
[ERROR]make[5]: *** [Makefile:616: sanitizer_platform_limits_linux.lo]
Error 1

It appears that with GCC 12 we now end up with different values for _MIPS_SIM.

Removing my "fix" resolves the issue for GCC 12 but I suspect something like
the suggestion from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105614#c7
might resolve the issue properly.