26d4ad
From 44cc1d696b6528712d92d33660dd8017dcd0b3e2 Mon Sep 17 00:00:00 2001
26d4ad
From: Stephan Bergmann <sbergman@redhat.com>
26d4ad
Date: Wed, 31 Jul 2019 16:57:31 +0200
26d4ad
Subject: [PATCH 1/2] Make sure to return value from non-void function
26d4ad
26d4ad
This had been commented out with 92145f058c88a9607341d8a20c3944a96ec00cf8
26d4ad
"All remaining memory leaks int tests removed. Fixes made by Veit and Anthony
26d4ad
Novatsis are incorporated" for no apparent reason---presumably by accident.
26d4ad
26d4ad
The effect (besides a -Wreturn-type warning) when building e.g. RelWithDebInfo
26d4ad
(i.e., with optimizations) on Fedora 30 (with GCC 9.1) was that the implicit
26d4ad
call to ~WhitespaceAnalyzer at the end of searchDocs was directly followed
26d4ad
(lacking the code sequence corresponding to "return 0;") by some compiler-
26d4ad
generated code to jump into some _Z10searchDocsPv.cold code (which is apparently
26d4ad
meant as an optimization, to be called from certain cold conditions) which
26d4ad
happened to also call ~WhitespaceAnalyzer.  The net effect was that the
26d4ad
26d4ad
    WhitespaceAnalyzer an;
26d4ad
26d4ad
object was deleted twice, causing a SIGSEGV.
26d4ad
---
26d4ad
 src/test/search/TestIndexSearcher.cpp | 2 +-
26d4ad
 1 file changed, 1 insertion(+), 1 deletion(-)
26d4ad
26d4ad
diff --git a/src/test/search/TestIndexSearcher.cpp b/src/test/search/TestIndexSearcher.cpp
26d4ad
index 5c410ff4..02c21aaf 100644
26d4ad
--- a/src/test/search/TestIndexSearcher.cpp
26d4ad
+++ b/src/test/search/TestIndexSearcher.cpp
26d4ad
@@ -28,7 +28,7 @@ _LUCENE_THREAD_FUNC(searchDocs, _searcher) {
26d4ad
     _CLLDELETE(query);
26d4ad
 
26d4ad
     CONDITION_WAIT(deleteMutex, deleteCondition);
26d4ad
-//    _LUCENE_THREAD_FUNC_RETURN(0);
26d4ad
+    _LUCENE_THREAD_FUNC_RETURN(0);
26d4ad
 }
26d4ad
 
26d4ad
 void testEndThreadException(CuTest *tc) {
26d4ad
-- 
26d4ad
2.21.0
26d4ad