libMesh/libmesh — pull request #390 by dschwen (2014-10-23 18:29:09+00:00)
Title: Fix FParser to build with clang 3.5

All our internal tests that use FParser crashed in FPoptimizer when built with clang 3.5. Closer inspections showed that the ```&*autoptr``` construct, which checks if an auto pointer contains a ```NULL``` pointer is the culprit. Clang 3.5 emits a compile time warning:

```
warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true
```

The prefix ```*``` operator in the fparser autopointer class returns a reference to the dereferenced pointer. While this seems to have worked just fine in older compilers it does not look very sane to me. Using clang 3.5 this works for ```-O0``` but horribly fails with ```-O2```. At this point I can only speculate that the optimization in clang 3.5 trips over the ```&*``` construct and makes the assumption (always true) mentioned in the warning (which then results in an illegal access / segfault).

The fix below consists of replacing the ```&*autoptr``` with ```!autoptr.isNull()``` and the implementation of a simple ```isNull()``` method in the auto pointer class.

One of the commits adds a modified version of ```Makefile.orig``` that allows rebuilding ```fpoptimizer.cc``` on mac systems (although we might want to integrate that a bit cleaner).