https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99092
Bug ID: 99092
Summary: Using -O3 and -fprefetch-loop-arrays to compile BLAS
on Apple M1 fails
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jeff.science at gmail dot com
Target Milestone: ---
Created attachment 50179
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50179&action=edit
source code that triggers bug
I am using GCC 10.2.1 installed via Homebrew on an Apple M1 system.
I attempted to compile one of the functions from the BLAS and it fails as
follows. The failure is triggered by the combined use of -O3 and
-fprefetch-loop-arrays. Reducing to -O2 or removing the latter eliminates the
issue, so there is a simple workaround. Nonetheless, I encountered it the
first time I tried to build NWChem on this platform, so it will be seen by
others until I can fix the NWChem build system to avoid it.
I do not see this issue on x86, although I am not sure if I have tested GCC
10.2.1 specifically.
% wget https://netlib.sandia.gov/blas/ctrsm.f # also attached
% gfortran -O3 -fprefetch-loop-arrays -c ctrsm.f && echo OKAY
/var/folders/8n/llwp7zmd4jx697g8sw5w46p00000gn/T//ccj3jW77.s:362:23: error:
index must be a multiple of 8 in range [0, 32760].
prfm PLDL1KEEP, [x0, -8]
^
% gfortran -O2 -fprefetch-loop-arrays -c ctrsm.f && echo OKAY
OKAY
% gfortran -O3 -c ctrsm.f && echo OKAY
OKAY
% gfortran --version
GNU Fortran (Homebrew GCC 10.2.0_3) 10.2.1 20201220
Copyright (C) 2020 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.