Created attachment 170165 [details]
This patch circumvents the problem by disabling stack checking.
Builds on i386 architecture and builds on amd64 using Intel processors build fine whereas builds on amd64 architecture using AMD CPUs (BARCELONA and BULLDOZER) still fail.
This discusses the problem: https://github.com/xianyi/OpenBLAS/issues/786. Unfortunately it doesn't discuss a fix, my builds on my BARCELONA processor still fail. The attached patch does workaround the problem but I don't think it's suitable for inclusion in ports.
Note the port builds properly on the BARCELONA and BULLDOZER CPUs in i386 (32-bit) mode but SEGFAULTS in amd64 (64-bit) mode. The port builds successfully on the Intel Sandy Bridge CPU in both modes (i386 and amd64).
A new comment in the previously mentioned thread suggests that increasing the buffer by 8 in line 245 of interface/ztrmv.c.
Created attachment 171221 [details]
Fixes stack allocation failure for AMD Bulldozer CPU.
This patch based on discussion at https://github.com/xianyi/OpenBLAS/issues/786 fixes this PR. Tested.
A commit references this bug:
Date: Thu Jun 9 02:14:50 UTC 2016
New revision: 416576
Fix SEGFAULT during build on AMD Barcelona CPUs. This patch is
based on discussion at https://github.com/xianyi/OpenBLAS/issues/786.
I'm the one who made the tests on the Github issue (and I found it through here, thank you for posting it).
I would like to point out that my tests were performed on a K8-class CPU, not BARCELONA or BULLDOZER. The important point is that my CPU is single-core, so SMP is disabled at compile-time. On SMP-capable machines (or at least whenever the build system somehow defines the `SMP` C symbol), the buffer size is computed in another code path, which is unchanged.
So I wouldn't consider the issue closed until someone with a multicore AMD CPU performs the same work as I to find the correct adjustment to the buffer size.
(In reply to Natacha Porté from comment #5)
Yes, I opened the PR (suggested by pi@ to track the bug) because my poudriere builds of net/openblas failed on my dual core Barcelona machines (but did build okay on my hyperthreaded dual core Ivy Bridge machine). The segfaults only occurred in 64-bit mode (not in 32-bit mode on Barcelona). (The problem also did not exist on my Ivy Bridge machine.) The workaround was to disable stack checking when building on Barcelona in 64-bit mode (amd64).
As there was confusion on https://github.com/xianyi/OpenBLAS/issues/786, because nobody could reliably reproduce the bug there, I posted that I had confirmed the existence of the bug.
Your solution was tested on one of the three dual core Barcelona machines (X2 machine) I have in my basement.
I mistakenly understood your earlier "tested" as referring my tests instead of yours. So thanks for your extra testing and for committing quickly (so I can go back to vanilla ports), and sorry for the extra noise (including the present comment).
*** Bug 207287 has been marked as a duplicate of this bug. ***