[Bug c++/106109] New: Internal compiler error

2022-06-27 Thread philip.deegan at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106109

Bug ID: 106109
   Summary: Internal compiler error
   Product: gcc
   Version: 12.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: philip.deegan at gmail dot com
  Target Milestone: ---

Hi,

With the release of FC36 and GCC12, we've begun to get an internal compiler
error for the following code,
https://github.com/PHAREHUB/PHARE/blob/master/tests/core/data/electrons/test_electrons.cpp#L464-L519

Firstly it says "invalid use of auto", but adding "-> void" to the lambda
resolves this, however following that we get an internal compiler error.

```
/io/tests/core/data/electrons/test_electrons.cpp: In member function ‘void
ElectronsTest_ThatElectronsVelocityEqualIonVelocityMinusJ_Test::TestBody()
[with gtest_TypeParam_ = std::pair,
PHARE::core::InterpConst<1> >]’:
/io/tests/core/data/electrons/test_electrons.cpp:519:10: internal compiler
error: Segmentation fault
  519 | check(this->Vex, this->Vix, this->Jx, Ne, GridYee::JxToMoments);
  | ~^~
Please submit a full bug report, with preprocessed source.
See  for instructions.
Preprocessed source stored into /tmp/ccCpGiQv.out file, please attach this to
your bugreport.
ninja: build stopped: subcommand failed.
```

```
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.1.1-20220507/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.1 20220507 (Red Hat 12.1.1-1) (GCC) 
```
ccCpGiQv.out is uploaded here:
https://gist.github.com/PhilipDeegan/c47eb44c96f579aa62d23ab1b5f2daa0

Changing to use a free templated function fails.
Commenting out the code inside the lambda fails.

If you have any issues building, we provide some Dockerfiles.
If this is in the wrong place please let me know.
Happy to test things to help investigate.

Thanks

[Bug c++/106109] Internal compiler error

2022-06-27 Thread philip.deegan at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106109

--- Comment #2 from Philip Deegan  ---
Created attachment 53211
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53211&action=edit
preprocessed source

[Bug c++/106109] Internal compiler error

2022-06-27 Thread philip.deegan at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106109

--- Comment #3 from Philip Deegan  ---
a bit more testing on our end, I think the issue stems from the lack of & on
GridYee::JxToMoments
https://github.com/PHAREHUB/PHARE/blob/master/tests/core/data/electrons/test_electrons.cpp#L519

> &GridYee::JxToMoments

I would have assumed not taking the address of a function would cause a
compiler error in this context.

adding in & resolves the internal compiler error.

sorry for the noise

[Bug c++/106109] Internal compiler error

2022-06-27 Thread philip.deegan at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106109

--- Comment #4 from Philip Deegan  ---
as a minimal reproducer 


`
template
class G
{
public:
auto static F() { return 1; }
};

int main()
{
auto fn = [](auto const& f) -> void { f(); };

fn(G::F);

return 0;
}
`

https://godbolt.org/z/f4WYnPvs6

Only if G is a template class does it appear