This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Segmentation fault on MacOS but not on Linux

+1 vote

Hi,

I'm running into a segmentation fault using MacOS when assembling a linear form whereas the same works perfectly fine on Linux. Here's a minimal (not on Mac) working example that is basically a shrinked version of the Navier-Stokes example provided within Dolfin:

main.cpp:

#include <dolfin.h>
#include "TentativeVelocity.h"
using namespace dolfin;
int main()
{
  Mesh mesh("../lshape.xml.gz");
  TentativeVelocity::FunctionSpace V(mesh);
  Constant f(0, 0);
  TentativeVelocity::LinearForm L1(V);
  L1.f = f;
  Vector b1;
  assemble(b1, L1);
  return 0;
}

where the TentativeVelocity.ufl file contains

V = VectorElement("Lagrange", triangle, 2)
u = TrialFunction(V)
v = TestFunction(V)
f  = Coefficient(V)
L  = inner(f, v) * dx 

and compiled using ffc -l dolfin. Everything compiles fine (version 1.4.0) on both MacOS (10.9.5) and Linux. However when I run t
he binary in Mac, I end up with a segmentation fault. LLDB tells

* thread #1: tid = 0xa2424, 0x000000010067cac4 libdolfin.1.4.dylib`dolfin::TensorLayout::local_range(unsigned long) const + 4, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x30)
    frame #0: 0x000000010067cac4 libdolfin.1.4.dylib`dolfin::TensorLayout::local_range(unsigned long) const + 4
libdolfin.1.4.dylib`dolfin::TensorLayout::local_range(unsigned long) const + 4:
-> 0x10067cac4:  movq   0x30(%rsi), %rax
   0x10067cac8:  shlq   $0x4, %rdx
   0x10067cacc:  movups (%rax,%rdx), %xmm0
   0x10067cad0:  movups %xmm0, (%rdi)

Is this a bug or am I doing something wrong?

Thanks in advance!

asked Oct 7, 2014 by ZNK6 FEniCS Novice (170 points)
...