OpenBLAS: GCC 7.X and `-funroll-loops` will produce seg-faults

I am pretty sure this is a compiler bug, but for completeness sake (and for other users) it may be valuable to have it here. If you think this warrants a bug-report for GCC, let me know and I will create it.

I have tried to compile OpenBLAS with these flags:

FC/CFLAGS = 
FC/CFLAGS = -funroll-loops

For the first case everything runs smoothly, tests works etc. For the second case seg-faults appear. Hence, one should not compile OpenBLAS with -funroll-loops for GCC 7.X.

For GCC 6.X -funroll-loops produces no seg-faults and works as expected.

Note that many other high optimization flags does not produce seg-faults, i.e. -O3 -fexpensive-optimizations -ftree-vectorize -fprefetch-loop-arrays -march=native works fine for both 6 and 7.

Perhaps you can filter-out the flag -funroll-loops from the CFLAGS/FCFLAGS env vars, if used?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 29 (9 by maintainers)

Commits related to this issue

Most upvoted comments

For gcc-7.2 on Kaby Lake (Haswell kernel), the minimum combination of options to reproduce the fault is -O1 -funroll-loops -fipa-ra On the other hand, -Os -funroll-loops -fipa-ra does not show the problem, indeed -fipa-ra is on by default at -Os. This option set overall is almost identical to that of -O2, differing only in -finline-functions and -foptimize-strlen (according to the output of gcc -Q -Os -help=optimizers at least - of course this does tell of any defects in the compiler code).