Hi, 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: Eigen/src/Core/util/Memory.h:90:13: error: array is too large (18446744073709551615 elements) new int[size_t(-1)]; ^~~~~~~~~~ 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? Thanks, - Aaron
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: new char[size_t(-1)]; or new int[size_t(-1)/sizeof(int)]; 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; new int[v]; 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: https://bitbucket.org/eigen/eigen/changeset/e0b15640d9d1/ changeset: e0b15640d9d1 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)
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/373.