https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127176
Bug ID: 127176
Summary: ICE in require, at machmode.h: 323 with
-foffload=amdgcn-amdhsa -O2
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: chilikin.k at gmail dot com
Target Milestone: ---
Created attachment 65468
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65468&action=edit
Test case
With the current development version (commit
82104cde7ac0ba2a80194048ca309e26c655ca6d), the following code
$ cat test.f90
MODULE M
TYPE T
REAL X(2)
END TYPE
CONTAINS
SUBROUTINE S()
IMPLICIT NONE
INTEGER I, J, K
TYPE(T), POINTER :: A(:)
!$ACC PARALLEL LOOP
DO I = 0, 10
DO K = 1, 100
DO J = 1, 2
A(K)%X(J) = A(K)%X(J) * 2
ENDDO
ENDDO
ENDDO
END SUBROUTINE
END MODULE
PROGRAM TEST
END PROGRAM
results in internal compiler error when offloading to amdgcn-amdhsa with "-O2"
optimization level:
$ gfortran -fopenacc -foffload=amdgcn-amdhsa="-march=gfx90c" -O2 -o test
test.f90
during RTL pass: combine
test.f90: In function ‘__m_MOD_s._omp_fn.0’:
test.f90:13:23: internal compiler error: in require, at machmode.h:323
13 | !$ACC PARALLEL LOOP
| ^
0x3226126 internal_error(char const*, ...)
../../gcc/gcc/diagnostic-global-context.cc:787
0x3234b25 fancy_abort(char const*, int, char const*)
../../gcc/gcc/diagnostics/context.cc:1813
0x1038d6b opt_mode<scalar_int_mode>::require() const
../../gcc/gcc/machmode.h:323
0x2e79521 gen_lowpart_or_truncate
../../gcc/gcc/combine.cc:8673
0x2e79918 force_to_mode
../../gcc/gcc/combine.cc:8774
0x2e79891 force_to_mode
../../gcc/gcc/combine.cc:8763
0x2e7d9f2 simplify_and_const_int_1
../../gcc/gcc/combine.cc:10124
0x2e7de6e simplify_and_const_int
../../gcc/gcc/combine.cc:10226
0x2e74e39 simplify_logical
../../gcc/gcc/combine.cc:7182
0x2e726b2 combine_simplify_rtx
../../gcc/gcc/combine.cc:6442
0x2e70120 subst
../../gcc/gcc/combine.cc:5665
0x2e6fe21 subst
../../gcc/gcc/combine.cc:5592
0x2e6fa99 subst
../../gcc/gcc/combine.cc:5526
0x2e68778 try_combine
../../gcc/gcc/combine.cc:3323
0x2e62c0f combine_instructions
../../gcc/gcc/combine.cc:1273
0x2e8ae65 rest_of_handle_combine
../../gcc/gcc/combine.cc:15187
0x2e8af20 execute
../../gcc/gcc/combine.cc:15231
/home/chilikin/usr/offloading/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/accel/amdgcn-amdhsa/lto1
-quiet -dumpbase ./test.xamdgcn-amdhsa.mkoffload -m64 -mfake-exceptions
-march=gfx90c -O2 -fno-openmp -fno-pie -fcf-protection=none -foffload-abi=lp64
-foffload-abi-host-opts=-m64 -fopenacc -o /tmp/ccHTX6q7.mkoffload.1.s
@/tmp/ccNcosZZ
The error is also present for version 15.2.0.