Bug 279267 - gofortran on i386: SIGBUS inside _gfortran_transfer_complex128_write
Summary: gofortran on i386: SIGBUS inside _gfortran_transfer_complex128_write
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: i386 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-24 08:08 UTC by Mikhail Teterin
Modified: 2024-05-24 08:08 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Teterin freebsd_committer freebsd_triage 2024-05-24 08:08:41 UTC
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.