https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109622
Bug ID: 109622
Summary: internal compiler error: in omp_group_base, at
gimplify.cc:9412 if -fopenacc is set.
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Created attachment 54916
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54916&action=edit
Simple file to reproduce the bug
Gfortran is git master branch, commit n°
f743863e09ad788b044dd01696b073581116843b from Apr 24 00:22:57
How to reproduce:
Small fortran file is attached (begou.f90).
gfortran -c -fopenacc begou.f90
0xa830c6 omp_group_base
../../gcc/gcc/gimplify.cc:9412
0xa830c6 omp_index_mapping_groups_1
../../gcc/gcc/gimplify.cc:9441
0xa833c7 omp_index_mapping_groups
../../gcc/gcc/gimplify.cc:9502
0xa96a9a gimplify_scan_omp_clauses
../../gcc/gcc/gimplify.cc:10802
0xa8660d gimplify_omp_target_update
../../gcc/gcc/gimplify.cc:15563
0xa8660d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16928
0xa89826 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7219
0xa875a3 gimplify_statement_list
../../gcc/gcc/gimplify.cc:2019
0xa875a3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16821
0xa89826 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7219
0xa86e8a gimplify_and_add(tree_node*, gimple**)
../../gcc/gcc/gimplify.cc:492
0xa86e8a gimplify_loop_expr
../../gcc/gcc/gimplify.cc:1993
0xa86e8a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16581
0xa89826 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7219
0xa875a3 gimplify_statement_list
../../gcc/gcc/gimplify.cc:2019
0xa875a3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16821
0xa89826 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7219
0xa89d2b gimplify_bind_expr
../../gcc/gcc/gimplify.cc:1430
0xa86d8e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16577
0xa89826 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7219
Script used for building the compiler:
#!/bin/sh
#
# Build GCC with support for offloading to NVIDIA GPUs.
#
work_dir=/robin/data/begou/GCC_GIT_BUILD
install_dir=/robin/data/begou/GCC_GIT_binaries
rm -rf $install_dir $work_dir/build-host-gcc $work_dir/build-nvptx-gcc
$work_dir/gcc $work_dir/nvptx-*
CC=$(which gcc)
CXX=$(which g++)
FC=$(which gfortran)
F90=$(which gfortran)
# Location of the installed CUDA toolkit
cuda=/opt/nvidia/hpc_sdk/Linux_x86_64/22.5/cuda/
# Build assembler and linking tools
mkdir -p $work_dir
cd $work_dir
git clone https://github.com/MentorEmbedded/nvptx-tools
cd nvptx-tools
./configure \
--with-cuda-driver-include=$cuda/include \
--with-cuda-driver-lib=$cuda/lib64 \
--prefix=$install_dir
make || exit 1
make install || exit 1
cd ..
# Set up the GCC source tree
git clone git://sourceware.org/git/newlib-cygwin.git nvptx-newlib
git clone git://gcc.gnu.org/git/gcc.git gcc
#git clone --branch releases/gcc-11 git://gcc.gnu.org/git/gcc.git gcc
cd gcc
contrib/download_prerequisites
ln -s ../nvptx-newlib/newlib newlib
cd ..
target=$(gcc/config.guess)
# Build nvptx GCC
mkdir build-nvptx-gcc
cd build-nvptx-gcc
../gcc/configure \
--disable-gcov \
--target=nvptx-none --with-build-time-tools=$install_dir/nvptx-none/bin \
--enable-as-accelerator-for=$target \
--disable-sjlj-exceptions \
--enable-newlib-io-long-long \
--enable-languages="c,c++,fortran,lto" \
--prefix=$install_dir
make -j`nproc` || exit 1
make install || exit 1
cd ..
# Build host GCC
mkdir build-host-gcc
cd build-host-gcc
../gcc/configure \
--enable-offload-targets=nvptx-none \
--with-cuda-driver-include=$cuda/include \
--with-cuda-driver-lib=$cuda/lib64 \
--disable-bootstrap \
--disable-multilib \
--enable-languages="c,c++,fortran,lto" \
--prefix=$install_dir
make -j`nproc` || exit 1
make install || exit 1
cd ..