Public bug reported:

WSL2:
Ubuntu 20.04.2 LTS (GNU/Linux 5.4.72-microsoft-standard-WSL2 x86_64)

$ lsb_release -rd
Description:    Ubuntu 20.04.2 LTS
Release:        20.04

$ apt-cache policy gcc-10
gcc-10:
  Installed: 10.2.0-5ubuntu1~20.04
  Candidate: 10.2.0-5ubuntu1~20.04
  Version table:
 *** 10.2.0-5ubuntu1~20.04 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 
Packages
        500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 
Packages
        100 /var/lib/dpkg/status
     10-20200411-0ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages

$ g++-10 -v
COLLECT_GCC=g++-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
10.2.0-5ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs 
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr 
--with-gcc-major-version-only --program-suffix=-10 
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new 
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin 
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release 
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch 
--disable-werror --with-arch-32=i686 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic 
--enable-offload-targets=nvptx-none=/build/gcc-10-WJNXnb/gcc-10-10.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-10-WJNXnb/gcc-10-10.2.0/debian/tmp-gcn/usr,hsa
 --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu 
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04)

$ cat main.cpp
int main() {
        int n;
        bool arr[3][n][n] {};
        if(arr[0][0][0]) {
            // don't optimize this out
            return 1;
        }
}

$ g++-10 main.cpp
during RTL pass: expand
main.cpp: In function ‘int main()’:
main.cpp:3:7: internal compiler error: in make_decl_rtl, at varasm.c:1342
    3 |  bool arr[3][n][n] {};
      |       ^~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

The type of arr can be any primitive (could possibly include more types,
didn't check). arr must be initialized with brackets. At least one of
the first two dimensions of arr must be a constant, while the last
dimension must be of variable length. I've repeated this behavior with
versions 5.1.0, 6.4.0, 7.3.0, 9.2.0 on online compilers.

** Affects: gcc-10 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1924219

Title:
  internal compiler error on certain variably sized 3d arrays

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-10/+bug/1924219/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to