[Bug 279267] gofortran on i386: SIGBUS inside _gfortran_transfer_complex128_write

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 24 May 2024 08:08:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279267

            Bug ID: 279267
           Summary: gofortran on i386: SIGBUS inside
                    _gfortran_transfer_complex128_write
           Product: Ports & Packages
           Version: Latest
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: mi@FreeBSD.org
                CC: salvadore@freebsd.org

Trying to install py-numpy, I tried both the OPENBLAS and the NETLIB options.

OPENBLASS does not even build (it dies while testing itself):
gfortran13 -O2 -march=native -Wl,-rpath=/opt/lib/gcc13 -O2 -m128bit-long-double
-Wall -frecursive -fno-optimize-sibling-calls -m32  -msse -msse2 -msse3 -mssse3
-msse4.1 -O2 -m128bit-long-double -Wall -frecursive -fno-optimize-sibling-calls
-m32  -msse -msse2 -msse3 -mssse3 -msse4.1 -fno-tree-vectorize 
-Wl,-rpath=/opt/lib/gcc13  -L/opt/lib/gcc13 -fstack-protector-strong  -o dblat3
dblat3.o ../libopenblas_nehalemp-r0.3.25.a -lpthread -lgfortran -lpthread
-lgfortran -L/usr/lib  -lc
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat1
gmake[1]: *** [Makefile:30: level1] Bus error (core dumped)
gmake[1]: *** Waiting for unfinished jobs....

The BLAS/CBLAS/LAPACK (NETLIB) don't bother with self-testing and install.
However, trying to use even load them (such by running "import numpy" inside a
Python script) crashes too.

In all cases the crash is inside:
#0  0x2845b346 in _gfortran_transfer_complex128_write () from
/opt/lib/gcc13/libgfortran.so.5
[New Thread 28a12000 (LWP 115657/<unknown>)]

I tried rebuilding everything with both gcc13 and 12 -- the crash is the same.

SIGBUS suggests a misalignment of input arguments -- perhaps, something ought
to be aligned at 128-bit, and is not (because i386).

My CFLAGS contain -march=sandybridge and my FFLAGS use -march=native instead.

The CPU-features are listed (in /var/run/dmesg.boot) as:
CPU: Intel(R) Core(TM) i5-9500 CPU @ 3.00GHz (3000.11-MHz 686-class CPU)
  Origin="GenuineIntel"  Id=0x906ea  Family=0x6  Model=0x9e  Stepping=10
 
Features=0x1783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,HTT>
 
Features2=0x5eda2203<SSE3,PCLMULQDQ,SSSE3,CX16,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>
  AMD Features=0x8100000<NX,RDTSCP>
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  Structured Extended
Features=0x42529<FSGSBASE,BMI1,AVX2,BMI2,INVPCID,NFPUSG,RDSEED>
  Structured Extended Features3=0x30000400<MD_CLEAR,L1DFL,ARCH_CAP>
  IA32_ARCH_CAPS=0x2000c04<RSBA>
  TSC: P-state invariant

However, this is a VM running under Oracle's VirtualBox supervisor.

According to OpenBLAS' Freshports-page, the port builds on i386 -- but it is
unclear, which version of gfortran it uses and which optimization flags.

-- 
You are receiving this mail because:
You are the assignee for the bug.