Bugzilla – Bug 373
Clang compilation fails with exceptions disabled
Last modified: 2011-12-05 09:46:17 UTC
When compiling any program that includes Eigen with -fno-exceptions in Clang, compilation will fail with the following error:
In file included from Eigen/Core:252:
array is too large (18446744073709551615 elements)
This has been tested with both Apple's clang included in the iOS SDK 5.0, and a Linux x86_64 clang version 2.9 (tags/RELEASE_29/final).
Perhaps abort() or something similar in this situation would work?
hm. It's computing at compile time that the byte size exceeds the max value of a size_t. I wonder if this is allowed by the c++ spec.
Does any of the following compile:
Either would work as that would still be guaranteed to fail at runtime.
Note that abort() is not an option here: we must generate a bad_alloc exception which is tricky when compiling with -fno-exceptions. The only way is to do a huge new.
Neither of those work, they still complain about being too large.
However, this does:
size_t v = -1;
Tried it with various optimization levels and it compiles (and runs resulting in a bad_alloc) on all of them.
thanks for finding this, seems to be harmless so:
date: 2011-12-05 09:44:25
summary: fig bug 373: compilation error with clang 2.9 when exceptions are disabled (cannot reproduce with clang 3.0 or 3.1)