From c9a515f4eec33ee778f7a44bf1aaba516f3cd5de Mon Sep 17 00:00:00 2001 From: Simon Gene Gottlieb Date: Fri, 16 Jul 2021 10:51:11 +0200 Subject: [PATCH] [FIX] Constructing large fm_indices Fixes std::accumulate using an int instead of a size_t. This fix allows building FM-Indices for texts bigger than 4 GiB. --- CHANGELOG.md | 9 +++++++++ include/seqan3/search/fm_index/fm_index.hpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa361eb02..6c95656f31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,15 @@ The following API changes should be documented as such: If possible, provide tooling that performs the changes, e.g. a shell-script. --> +# 3.1.0 + +## Notable Bug-fixes + +#### Search + +* Resolved an issue that prevented the FM-Index from being constructed correctly for inputs larger than 4 GiB + ([\#2756](https://github.com/seqan/seqan3/pull/2756)). + # 3.0.3 Note that 3.1.0 will be the first API stable release and interfaces in this release might still change. diff --git a/include/seqan3/search/fm_index/fm_index.hpp b/include/seqan3/search/fm_index/fm_index.hpp index 2377f2a92a..76b23ed3fd 100644 --- a/include/seqan3/search/fm_index/fm_index.hpp +++ b/include/seqan3/search/fm_index/fm_index.hpp @@ -293,7 +293,7 @@ class fm_index size_t const number_of_texts{text_sizes.size()}; // text size including delimiters - size_t const text_size = std::accumulate(text_sizes.begin(), text_sizes.end(), 0) + number_of_texts; + size_t const text_size = std::accumulate(text_sizes.begin(), text_sizes.end(), number_of_texts); if (number_of_texts == text_size) throw std::invalid_argument("A text collection that only contains empty texts cannot be indexed.");