Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add Github Action for codeql #524

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

ci: Add Github Action for codeql #524

wants to merge 4 commits into from

Conversation

axic
Copy link
Member

@axic axic commented Sep 8, 2020

No description provided.

@codecov
Copy link

codecov bot commented Oct 7, 2020

Codecov Report

Merging #524 (7b700be) into master (1fa057b) will decrease coverage by 0.13%.
The diff coverage is n/a.

❗ Current head 7b700be differs from pull request most recent head 7f19e0e. Consider uploading reports for the commit 7f19e0e to get more accurate results

@@            Coverage Diff             @@
##           master     #524      +/-   ##
==========================================
- Coverage   99.26%   99.12%   -0.14%     
==========================================
  Files          88       85       -3     
  Lines       13268    13010     -258     
==========================================
- Hits        13170    12896     -274     
- Misses         98      114      +16     
Flag Coverage Δ
rust 99.90% <0.00%> (+1.42%) ⬆️
spectests 89.98% <0.00%> (?)
unittests 98.94% <0.00%> (?)
unittests-32 99.03% <0.00%> (-0.29%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tools/wasi/wasi.cpp 60.18% <0.00%> (-32.41%) ⬇️
lib/fizzy/capi.cpp 95.41% <0.00%> (-0.28%) ⬇️
lib/fizzy/execute.cpp 99.29% <0.00%> (-0.02%) ⬇️
lib/fizzy/execute.hpp 100.00% <0.00%> (ø)
lib/fizzy/instructions.cpp 100.00% <0.00%> (ø)
lib/fizzy/execution_context.hpp 100.00% <0.00%> (ø)
test/unittests/execute_test.cpp 100.00% <0.00%> (ø)
test/unittests/instantiate_test.cpp 100.00% <0.00%> (ø)
test/unittests/capi_execute_test.cpp 100.00% <0.00%> (ø)
test/unittests/floating_point_utils_test.cpp 100.00% <0.00%> (ø)
... and 8 more

@axic
Copy link
Member Author

axic commented Jan 27, 2021

codeql is failing, it seems to be using gcc 7.5.0:

Scanning dependencies of target fizzy
[  1%] Building CXX object lib/fizzy/CMakeFiles/fizzy.dir/asserts.cpp.o
[  2%] Building CXX object lib/fizzy/CMakeFiles/fizzy.dir/capi.cpp.o
In file included from /usr/include/c++/7/vector:62:0,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/types.hpp:12,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/module.hpp:7,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/instantiate.hpp:10,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/execute.hpp:9,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/capi.cpp:6:
/usr/include/c++/7/bits/stl_construct.h: In instantiation of ‘void std::_Construct(_T1*, _Args&& ...) [with _T1 = fizzy::Import; _Args = {const fizzy::Import&}]’:
/usr/include/c++/7/bits/stl_uninitialized.h:83:18:   required from ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const fizzy::Import*, std::vector<fizzy::Import> >; _ForwardIterator = fizzy::Import*; bool _TrivialValueTypes = false]’
/usr/include/c++/7/bits/stl_uninitialized.h:134:15:   required from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const fizzy::Import*, std::vector<fizzy::Import> >; _ForwardIterator = fizzy::Import*]’
/usr/include/c++/7/bits/stl_uninitialized.h:289:37:   required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const fizzy::Import*, std::vector<fizzy::Import> >; _ForwardIterator = fizzy::Import*; _Tp = fizzy::Import]’
/usr/include/c++/7/bits/stl_vector.h:331:31:   required from ‘std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = fizzy::Import; _Alloc = std::allocator<fizzy::Import>]’
/home/runner/work/fizzy/fizzy/lib/fizzy/module.hpp:14:8:   required from ‘typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = fizzy::Module; _Args = {const fizzy::Module&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<fizzy::Module, std::default_delete<fizzy::Module> >]’
/home/runner/work/fizzy/fizzy/lib/fizzy/capi.cpp:359:69:   required from here
/usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function ‘fizzy::Import::Import(const fizzy::Import&)’
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/fizzy/fizzy/lib/fizzy/module.hpp:7:0,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/instantiate.hpp:10,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/execute.hpp:9,
                 from /home/runner/work/fizzy/fizzy/lib/fizzy/capi.cpp:6:
/home/runner/work/fizzy/fizzy/lib/fizzy/types.hpp:325:8: note: ‘fizzy::Import::Import(const fizzy::Import&)’ is implicitly deleted because the default definition would be ill-formed:
 struct Import
        ^~~~~~
/home/runner/work/fizzy/fizzy/lib/fizzy/types.hpp:325:8: error: use of deleted function ‘fizzy::Import::<unnamed union>::<constructor>(const fizzy::Import::<unnamed union>&)’
/home/runner/work/fizzy/fizzy/lib/fizzy/types.hpp:331:5: note: ‘fizzy::Import::<unnamed union>::<constructor>(const fizzy::Import::<unnamed union>&)’ is implicitly deleted because the default definition would be ill-formed:
     {
     ^
/home/runner/work/fizzy/fizzy/lib/fizzy/types.hpp:333:16: error: union member ‘fizzy::Import::<unnamed union>::memory’ with non-trivial ‘constexpr fizzy::Memory::Memory(const fizzy::Memory&)’
         Memory memory;
                ^~~~~~
/home/runner/work/fizzy/fizzy/lib/fizzy/types.hpp:335:15: error: union member ‘fizzy::Import::<unnamed union>::table’ with non-trivial ‘constexpr fizzy::Table::Table(const fizzy::Table&)’
         Table table;
               ^~~~~
cc1plus: error: unrecognized command line option ‘-Wno-unknown-attributes’ [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [lib/fizzy/CMakeFiles/fizzy.dir/capi.cpp.o] Error 1
make[1]: *** [lib/fizzy/CMakeFiles/fizzy.dir/all] Error 2
lib/fizzy/CMakeFiles/fizzy.dir/build.make:94: recipe for target 'lib/fizzy/CMakeFiles/fizzy.dir/capi.cpp.o' failed
CMakeFiles/Makefile2:441: recipe for target 'lib/fizzy/CMakeFiles/fizzy.dir/all' failed
make: *** [all] Error 2
Makefile:159: recipe for target 'all' failed
Error: Process completed with exit code 2.

@gumb0 @chfast do you think we can easily fix this? If it is messy, we should just mark old gcc unsupported (should also have the minimum compiler versions set in cmake).

@gumb0
Copy link
Collaborator

gumb0 commented Jan 28, 2021

@gumb0 @chfast do you think we can easily fix this? If it is messy, we should just mark old gcc unsupported (should also have the minimum compiler versions set in cmake).

Looks to be a limitation of std::optional in old GCC:

I don't see any easy fix for this other than replacing std::optional with something else like bool+uint32_t, maybe it's not worth it.

@axic
Copy link
Member Author

axic commented Jan 28, 2021

I'd vote for requiring gcc 8.3 as the minimum.

@gumb0
Copy link
Collaborator

gumb0 commented Jan 28, 2021

  • union is not allowed to have non-trivially constructed members

Actually this was true only till C++11, now we can define our own union constructors... I'll try something.

@axic axic added this to In progress in 0.8.0 via automation Mar 11, 2021
@@ -446,7 +446,7 @@ T fnearest(T value) noexcept
}

template <typename T>
__attribute__((no_sanitize("float-divide-by-zero"))) inline constexpr T fdiv(T a, T b) noexcept
[[gnu::no_sanitize("float-divide-by-zero")]] inline constexpr T fdiv(T a, T b) noexcept
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chfast is it useful merging these changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently it doesn't work as the sanitizer task reports division-by-zero.

@axic
Copy link
Member Author

axic commented Mar 29, 2021

@gumb0 @chfast do we want to specify minimum required compiler versions in cmake/readme? It seems gcc >=8.3 is required unless we want to merge this commit from @gumb0.

@chfast
Copy link
Collaborator

chfast commented Mar 30, 2021

@gumb0 @chfast do we want to specify minimum required compiler versions in cmake/readme? It seems gcc >=8.3 is required unless we want to merge this commit from @gumb0.

No.

@axic
Copy link
Member Author

axic commented Mar 31, 2021

Why not? This PR showed that fizzy was not compiling with gcc<8.3.

@chfast
Copy link
Collaborator

chfast commented Mar 31, 2021

Why not? This PR showed that fizzy was not compiling with gcc<8.3.

If you want to do this, you need to create CI jobs with the discovered compiler version. I don't think this is worth the time right now.

@axic axic removed this from In progress in 0.8.0 May 23, 2022
axic and others added 4 commits June 21, 2022 13:25
This fixes Import being not copy-constructible in GCC older than 8.3, where std::optional is not trivially constructible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants