From 9945502e50e38bd5bb690ec403d96fcef5d87abf Mon Sep 17 00:00:00 2001 From: michaelhutt Date: Thu, 12 May 2016 16:44:09 -0400 Subject: [PATCH] fixes std::bad_alloc in processPhraseTableMin for large models + only seems to affect the Intel compiler at O3 --- moses/TranslationModel/CompactPT/CanonicalHuffman.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moses/TranslationModel/CompactPT/CanonicalHuffman.h b/moses/TranslationModel/CompactPT/CanonicalHuffman.h index 9f6c14e56..10f3019b1 100644 --- a/moses/TranslationModel/CompactPT/CanonicalHuffman.h +++ b/moses/TranslationModel/CompactPT/CanonicalHuffman.h @@ -76,8 +76,9 @@ private: MinHeapSorter hs(A); std::make_heap(A.begin(), A.begin() + n, hs); - size_t h = n; - size_t m1, m2; + // marked volatile to prevent the intel compiler from generating bad code + volatile size_t h = n; + volatile size_t m1, m2; while(h > 1) { m1 = A[0]; std::pop_heap(A.begin(), A.begin() + h, hs);