From: Morgan Deters Date: Wed, 19 Jun 2013 22:27:42 +0000 (-0400) Subject: Workaround for suspected clang 3.0 codegen bug on Mac X-Git-Tag: cvc5-1.0.0~7287^2~93 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7374f204559ef62a1c23de6b286c8ba3eb3efa5d;p=cvc5.git Workaround for suspected clang 3.0 codegen bug on Mac --- diff --git a/src/theory/type_enumerator.h b/src/theory/type_enumerator.h index 777326a26..467bf1927 100644 --- a/src/theory/type_enumerator.h +++ b/src/theory/type_enumerator.h @@ -98,7 +98,10 @@ public: ~TypeEnumerator() { delete d_te; } bool isFinished() throw() { -#ifdef CVC4_ASSERTIONS +// On Mac clang, there appears to be a code generation bug in an exception +// block here. For now, there doesn't appear a good workaround; just disable +// assertions on that setup. +#if defined(CVC4_ASSERTIONS) && !(defined(__APPLE__) && defined(__clang__)) if(d_te->isFinished()) { try { **d_te; @@ -108,6 +111,8 @@ public: // // This block can crash on clang 3.0 on Mac OS, perhaps related to // bug: http://llvm.org/bugs/show_bug.cgi?id=13359 + // + // Hence the #if !(defined(__APPLE__) && defined(__clang__)) above } } else { try { @@ -116,11 +121,14 @@ public: Assert(false, "didn't expect a NoMoreValuesException to be thrown"); } } -#endif /* CVC4_ASSERTIONS */ +#endif /* CVC4_ASSERTIONS && !(APPLE || clang) */ return d_te->isFinished(); } Node operator*() throw(NoMoreValuesException) { -#ifdef CVC4_ASSERTIONS +// On Mac clang, there appears to be a code generation bug in an exception +// block above (and perhaps here, too). For now, there doesn't appear a +// good workaround; just disable assertions on that setup. +#if defined(CVC4_ASSERTIONS) && !(defined(__APPLE__) && defined(__clang__)) try { Node n = **d_te; Assert(n.isConst()); @@ -130,9 +138,9 @@ public: Assert(isFinished()); throw; } -#else /* CVC4_ASSERTIONS */ +#else /* CVC4_ASSERTIONS && !(APPLE || clang) */ return **d_te; -#endif /* CVC4_ASSERTIONS */ +#endif /* CVC4_ASSERTIONS && !(APPLE || clang) */ } TypeEnumerator& operator++() throw() { ++*d_te; return *this; } TypeEnumerator operator++(int) throw() { TypeEnumerator te = *this; ++*d_te; return te; }