From 63aa95d4cb726822964af7b37a824dac9c4f7789 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Wed, 14 Nov 2018 22:36:05 +0100 Subject: [PATCH] CaloRec: Fix undefined behavior sanitizer warning. Force the test to have a link dependency on libCaloRecLib; otherwise, the linker will remove the dependency. And if we don't link against libCaloRecLib, then we can get ubsan errors related to ConstDataVector<CaloCellCollection> because in that case, the typeinfo for it won't get exported from the test binary. --- .../test/CaloCellContainerFromClusterTool_test.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Calorimeter/CaloRec/test/CaloCellContainerFromClusterTool_test.cxx b/Calorimeter/CaloRec/test/CaloCellContainerFromClusterTool_test.cxx index 7758e01ca14..b5150c7c79d 100644 --- a/Calorimeter/CaloRec/test/CaloCellContainerFromClusterTool_test.cxx +++ b/Calorimeter/CaloRec/test/CaloCellContainerFromClusterTool_test.cxx @@ -26,6 +26,7 @@ #include "CaloEvent/CaloTester.h" #include "CaloGeoHelpers/CaloPhiRange.h" #include "CaloDetDescr/CaloDetectorElements.h" +#include "CaloRec/Blob2ToolConstants.h" #include "StoreGate/setupStoreGate.h" #include "StoreGate/StoreGateSvc.h" #include "AthenaKernel/ExtendedEventContext.h" @@ -227,3 +228,15 @@ int main (int /*argc*/, char** argv) test1 (calotest, *sg); return 0; } + + + +// Force a link dependency on libCaloRecLib; otherwise, the linker +// will remove the dependency. And if we don't link against libCaloRecLib, +// then we can get ubsan errors related to ConstDataVector<CaloCellCollection> +// because in that case, the typeinfo for it won't get exported from +// the test binary. +void dum() +{ + Blob2ToolConstants ref ("", "", nullptr); +} -- GitLab