make -B test/unit/math/mix/scal/prob/normal_test
will produce a binary (with clang) that segfaults. With g++ it actually won’t even compile,
goodrich@T540p:/opt/stan/lib/stan_math_2.7.0$ make -B test/unit/math/mix/scal/prob/normal_test
g++-7 -Wall -I . -isystem lib/eigen_3.3.3 -isystem lib/boost_1.64.0 -isystem lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -fopenmp -DGTEST_USE_OWN_TR1_TUPLE -DGTEST_HAS_PTHREAD=0 -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 -Og -DGTEST_USE_OWN_TR1_TUPLE -DGTEST_HAS_PTHREAD=0 -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 -Og -DNO_FPRINTF_OUTPUT -pipe -c -o test/unit/math/mix/scal/prob/normal_test.o test/unit/math/mix/scal/prob/normal_test.cpp
g++-7 -Wall -I . -isystem lib/eigen_3.3.3 -isystem lib/boost_1.64.0 -isystem lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -fopenmp -DGTEST_USE_OWN_TR1_TUPLE -DGTEST_HAS_PTHREAD=0 -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 -Og -DGTEST_USE_OWN_TR1_TUPLE -DGTEST_HAS_PTHREAD=0 -isystem lib/gtest_1.7.0/include -isystem lib/gtest_1.7.0 -Og -DNO_FPRINTF_OUTPUT -pipe -c -o lib/gtest_1.7.0/src/gtest-all.o lib/gtest_1.7.0/src/gtest-all.cc
In file included from ./stan/math/prim/scal/prob/normal_log.hpp:5:0,
from ./stan/math/prim/scal.hpp:335,
from ./stan/math/mix/scal.hpp:18,
from test/unit/math/mix/scal/prob/normal_test.cpp:1:
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::var; T_loc = stan::math::var; T_scale = stan::math::var; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::var]’:
./stan/math/prim/scal/prob/normal_log.hpp:34:50: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::var; T_loc = stan::math::var; T_scale = stan::math::var; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::var]’
test/unit/math/mix/scal/prob/normal_test.cpp:18:56: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = int; T_loc = int; T_scale = stan::math::fvar<double>; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<double>]’:
./stan/math/prim/scal/prob/normal_log.hpp:34:50: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = int; T_loc = int; T_scale = stan::math::fvar<double>; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<double>]’
test/unit/math/mix/scal/prob/normal_test.cpp:30:65: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::fvar<stan::math::fvar<double> >; T_loc = int; T_scale = int; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::fvar<double> >]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:126:28: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with T_y = stan::math::fvar<stan::math::fvar<double> >; T_loc = int; T_scale = int; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::fvar<double> >]’
./stan/math/prim/scal/prob/normal_log.hpp:43:42: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with T_y = stan::math::fvar<stan::math::fvar<double> >; T_loc = int; T_scale = int; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::fvar<double> >]’
test/unit/math/mix/scal/prob/normal_test.cpp:35:3: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: user defined reduction not found for ‘logp’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::fvar<double>; T_loc = int; T_scale = int; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<double>]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:126:28: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with T_y = stan::math::fvar<double>; T_loc = int; T_scale = int; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<double>]’
./stan/math/prim/scal/prob/normal_log.hpp:43:42: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with T_y = stan::math::fvar<double>; T_loc = int; T_scale = int; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<double>]’
test/unit/math/mix/scal/prob/normal_test.cpp:36:3: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::fvar<stan::math::var>; T_loc = double; T_scale = double; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:126:28: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with T_y = stan::math::fvar<stan::math::var>; T_loc = double; T_scale = double; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’
./stan/math/prim/scal/prob/normal_log.hpp:43:42: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with T_y = stan::math::fvar<stan::math::var>; T_loc = double; T_scale = double; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’
test/unit/math/mix/scal/prob/normal_test.cpp:49:44: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: user defined reduction not found for ‘logp’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = double; T_loc = stan::math::fvar<stan::math::var>; T_scale = double; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:126:28: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with T_y = double; T_loc = stan::math::fvar<stan::math::var>; T_scale = double; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’
./stan/math/prim/scal/prob/normal_log.hpp:43:42: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with T_y = double; T_loc = stan::math::fvar<stan::math::var>; T_scale = double; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’
test/unit/math/mix/scal/prob/normal_test.cpp:65:44: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: user defined reduction not found for ‘logp’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In instantiation of ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = double; T_loc = double; T_scale = stan::math::fvar<stan::math::var>; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:126:28: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with T_y = double; T_loc = double; T_scale = stan::math::fvar<stan::math::var>; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’
./stan/math/prim/scal/prob/normal_log.hpp:43:42: required from ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_log(const T_y&, const T_loc&, const T_scale&) [with T_y = double; T_loc = double; T_scale = stan::math::fvar<stan::math::var>; typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type = stan::math::fvar<stan::math::var>]’
test/unit/math/mix/scal/prob/normal_test.cpp:80:44: required from here
./stan/math/prim/scal/prob/normal_lpdf.hpp:82:46: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (length(sigma) > 3 * omp_get_max_threads()) \
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: user defined reduction not found for ‘logp’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In function ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::fvar<stan::math::fvar<double> >; T_loc = int; T_scale = int]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:105:12: error: ‘logp’ not specified in enclosing ‘parallel’
logp += NEG_LOG_SQRT_TWO_PI;
~~~~~^~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: enclosing ‘parallel’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In function ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = stan::math::fvar<stan::math::var>; T_loc = double; T_scale = double]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:105:12: error: ‘logp’ not specified in enclosing ‘parallel’
logp += NEG_LOG_SQRT_TWO_PI;
~~~~~^~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: enclosing ‘parallel’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In function ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = double; T_loc = stan::math::fvar<stan::math::var>; T_scale = double]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:105:12: error: ‘logp’ not specified in enclosing ‘parallel’
logp += NEG_LOG_SQRT_TWO_PI;
~~~~~^~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: enclosing ‘parallel’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
./stan/math/prim/scal/prob/normal_lpdf.hpp: In function ‘typename stan::return_type<T_y, T_scale_succ, T_scale_fail>::type stan::math::normal_lpdf(const T_y&, const T_loc&, const T_scale&) [with bool propto = false; T_y = double; T_loc = double; T_scale = stan::math::fvar<stan::math::var>]’:
./stan/math/prim/scal/prob/normal_lpdf.hpp:105:12: error: ‘logp’ not specified in enclosing ‘parallel’
logp += NEG_LOG_SQRT_TWO_PI;
~~~~~^~~~~~~~~~~~~~~~~~~~~~
./stan/math/prim/scal/prob/normal_lpdf.hpp:90:11: error: enclosing ‘parallel’
#pragma omp parallel for if (N > 3 * omp_get_max_threads()) \
^~~
<builtin>: recipe for target 'test/unit/math/mix/scal/prob/normal_test.o' failed
make: *** [test/unit/math/mix/scal/prob/normal_test.o] Error 1
I just did -H
to verify that the headers were being included; the behavior is the same with or without it. Also, test/unit/math/prim
, test/unit/math/rev
, and test/unit/math/fwd
all pass, so if it is an issue with include ordering it is specific to mix and not triggered by what we are currently doing on the develop branch.