2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 <2022> 2023 2024 2025 | Index | 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 <2022> 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | lgtm.com, and a heads-up about gcc 10 |
From: | Andrew Johnson via Core-talk <core-talk at aps.anl.gov> |
To: | EPICS core-talk <core-talk at aps.anl.gov> |
Date: | Mon, 14 Feb 2022 13:06:49 -0600 |
I've been spending a few minutes playing with a code security analysis site lgtm.com which seems to be related to GitHub somehow. It was already doing something with Base when I found it (but only the Python code analysis was working). I tried configuring it to actually build Base but the build failed because it seems to be using GCC-10. Here's the section of my build log showing the failure, in modules/pvData/testApp:
[2022-02-14 18:26:31] [build-stdout] /usr/bin/g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -DPVD_INTERNAL -D_X86_64_ -DUNIX -Dlinux -O3 -g -Wall -mtune=generic -m64 -I. -I../O.Common -I. -I. -I.. -I../../testApp/misc -I../../testApp/pv -I../../testApp/property -I../../testApp/copy -I/opt/src/include/compiler/gcc -I/opt/src/include/os/Linux -I/opt/src/include -I/opt/src/include/compiler/gcc -I/opt/src/include/os/Linux -I/opt/src/include -c ../../testApp/misc/testSharedVector.cpp [2022-02-14 18:26:32] [build-stderr] In file included from /opt/src/include/pv/pvData.h:23, [2022-02-14 18:26:32] [build-stderr] from /opt/src/include/pv/pvUnitTest.h:15, [2022-02-14 18:26:32] [build-stderr] from ../../testApp/misc/testSharedVector.cpp:15: [2022-02-14 18:26:32] [build-stderr] /opt/src/include/pv/typeCast.h: In static member function ‘static epics::pvData::shared_vector<TO> epics::pvData::detail::shared_vector_converter<TO, FROM, Enable>::op(const epics::pvData::shared_vector<FROM>&) [with TO = float; FROM = int; Enable = void]’: [2022-02-14 18:26:32] [build-stderr] /opt/src/include/pv/typeCast.h:195:24: error: inlining failed in call to always_inline ‘TO epics::pvData::castUnsafe(const FROM&) [with TO = float; FROM = int]’: indirect function call with a yet undetermined callee [2022-02-14 18:26:32] [build-stderr] 195 | static FORCE_INLINE TO castUnsafe(const FROM& from) [2022-02-14 18:26:32] [build-stderr] | ^~~~~~~~~~ [2022-02-14 18:26:32] [build-stderr] In file included from /usr/include/c++/9/algorithm:62, [2022-02-14 18:26:32] [build-stderr] from /opt/src/include/pv/pvData.h:15, [2022-02-14 18:26:32] [build-stderr] from /opt/src/include/pv/pvUnitTest.h:15, [2022-02-14 18:26:32] [build-stderr] from ../../testApp/misc/testSharedVector.cpp:15: [2022-02-14 18:26:32] [build-stderr] /usr/include/c++/9/bits/stl_algo.h:4337:24: note: called from here [2022-02-14 18:26:32] [build-stderr] 4337 | *__result = __unary_op(*__first); [2022-02-14 18:26:32] [build-stderr] | ~~~~~~~~~~^~~~~~~~~~ [2022-02-14 18:26:32] [build-stderr] In file included from /opt/src/include/pv/pvData.h:23, [2022-02-14 18:26:32] [build-stderr] from /opt/src/include/pv/pvUnitTest.h:15, [2022-02-14 18:26:32] [build-stderr] from ../../testApp/misc/testSharedVector.cpp:15: [2022-02-14 18:26:32] [build-stderr] /opt/src/include/pv/typeCast.h: In static member function ‘static epics::pvData::shared_vector<TO> epics::pvData::detail::shared_vector_converter<TO, FROM, Enable>::op(const epics::pvData::shared_vector<FROM>&) [with TO = double; FROM = int; Enable = void]’: [2022-02-14 18:26:32] [build-stderr] /opt/src/include/pv/typeCast.h:195:24: error: inlining failed in call to always_inline ‘TO epics::pvData::castUnsafe(const FROM&) [with TO = double; FROM = int]’: indirect function call with a yet undetermined callee [2022-02-14 18:26:32] [build-stderr] 195 | static FORCE_INLINE TO castUnsafe(const FROM& from) [2022-02-14 18:26:32] [build-stderr] | ^~~~~~~~~~ [2022-02-14 18:26:32] [build-stderr] In file included from /usr/include/c++/9/algorithm:62, [2022-02-14 18:26:32] [build-stderr] from /opt/src/include/pv/pvData.h:15, [2022-02-14 18:26:32] [build-stderr] from /opt/src/include/pv/pvUnitTest.h:15, [2022-02-14 18:26:32] [build-stderr] from ../../testApp/misc/testSharedVector.cpp:15: [2022-02-14 18:26:32] [build-stderr] /usr/include/c++/9/bits/stl_algo.h:4337:24: note: called from here [2022-02-14 18:26:32] [build-stderr] 4337 | *__result = __unary_op(*__first); [2022-02-14 18:26:32] [build-stderr] | ~~~~~~~~~~^~~~~~~~~~ [2022-02-14 18:26:34] [build-stdout] make[4]: Leaving directory '/opt/src/modules/pvData/testApp/O.linux-x86_64'
To play with it on lgtm.com (which builds on a recent version of Ubuntu) you can paste in some analysis configuration YAML here to configure it without having to add a file to the repo, this is what I used to get the above:
extraction: cpp: index: build_command: "make"
It is possible to tell it to install a different version of gcc
using a prepare: section but I
don't know what the right packages would be. It was interesting to
see that it automatically installed g++ during the above
build the first time it was called, is that something which Ubuntu
does (or can do) now?
Not sure if this is likely to be useful for us, but I thought it
might be worth exploring. I haven't been able to look into the
actual code analysis it can do yet.
- Andrew
-- Complexity comes for free, Simplicity you have to work for.