Skip to content

Commit f9ab653

Browse files
committed
Workaround for possible macos clang compiler issue
1 parent 1fbe49d commit f9ab653

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

utils/data_model_to_pymcell/bngl_generator.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ static bool has_in_out_compartments(const vector<string>& substances) {
308308
static void check_that_only_allowed_orientations_are_set(
309309
const vector<string>& orientations, const bool has_in_out_compartments) {
310310

311+
// causes weird behavior on macos
311312
// if IN/OUT is not used, volume molecules must not have orientation and
312313
// surface molecules must be UP
313314
// NOTE: this check can be improed with detection of what type of complex it is surface or volume
@@ -438,8 +439,17 @@ void BNGLGenerator::generate_single_count(
438439
const std::string& what_to_count,
439440
const bool molecules_not_species) {
440441

441-
bng_out << IND <<
442-
((molecules_not_species) ? BNG::OBSERVABLE_MOLECULES : BNG::OBSERVABLE_SPECIES) << " " <<
442+
bng_out << IND;
443+
// there is some issue with macos Apple LLVM version 10.0.0 (clang-1000.10.44.4)
444+
// this gets miscompiled with optimizations enabled: ((molecules_not_species) ? BNG::OBSERVABLE_MOLECULES : BNG::OBSERVABLE_SPECIES)
445+
if (molecules_not_species) {
446+
bng_out << BNG::OBSERVABLE_MOLECULES;
447+
}
448+
else {
449+
bng_out << BNG::OBSERVABLE_SPECIES;
450+
}
451+
452+
bng_out << " " <<
443453
fix_id(observable_name) << " " <<
444454
what_to_count << "\n";
445455
}

0 commit comments

Comments
 (0)