Hi all,
I can confirm that the build fails with clang 3.4 and that the patch
sent by Alexander fixes the problem.
The most recent version of clang (3.5), however, compiles the package
fine without any patches. This is because Clang has extended its
detection of constant values and is now able to detect that the used
size is a constant value, even if it's passed through a function.
In case you decide to patch the code anyway (after all it's non-standard
language features that make it compile - GCC's support for VLAs and
Clang's extended detection of constant values), there's an alternative
patch attached to this message. I originally created it because I didn't
realize that Alexander had already attached a patch (I'm sorry,
Alexander, I didn't mean to disappreciate your work!). Now I decided to
send it in anyway because it's an alternative way to fix the problem,
one that's probably closer to the upstream authors' intention to
allocate the space on the stack using a fixed-length array.
Btw. I noted that there has been a jellyfish 2 out there for quite some
time now (almost a year). As they moved to github for the 2.x releases
and the watch file is only targeting the old html page, maybe you missed
it...
Cheers,
Martin
Description: Fix clang (< 3.5) compilation by avoiding VLAs
The length of the array defined locally in array::_get_val
cannot be detected to be constant by a standard C++ compiler.
GCC's g++ accepts the code anyway because of its ample
support for variable-length arrays (VLAs). Clang doesn't
support VLAs for non-POD (Plain Old Type) types. Starting
from version 3.5, however, it is able to detect the constant
nature of the value used (using non-standard language
features, too) and therefore doesn't need LVAs here. However,
clang compilers before 3.5 as well as compilers that support
only pure C++ need this patching.
Author: Martin Steghöfer <[email protected]>
Bug-Debian: https://bugs.debian.org/749136
--- jellyfish-1.1.11.orig/jellyfish/invertible_hash_array.hpp
+++ jellyfish-1.1.11/jellyfish/invertible_hash_array.hpp
@@ -636,7 +636,7 @@ namespace jellyfish {
bool _get_val(const size_t id, size_t &key_id, const word key, word &val,
bool full = false, bool carry_bit = false) const {
// Buffer for pre-cached information
- prefetch_info info_ary[prefetch_buffer::capacity()];
+ prefetch_info info_ary[prefetch_buffer::capacityConstant];
prefetch_buffer buffer(info_ary);
warm_up_cache(buffer, id, false);
--- jellyfish-1.1.11.orig/jellyfish/simple_circular_buffer.hpp
+++ jellyfish-1.1.11/jellyfish/simple_circular_buffer.hpp
@@ -106,6 +106,7 @@ namespace jellyfish {
class pre_alloc : public base<T, pre_alloc<T, capa> > {
typedef base<T, pre_alloc<T, capa> > super;
public:
+ static const int capacityConstant = capa;
explicit pre_alloc(T* data) : super(data) { }
static int capacity() { return capa; }
};