Commit 411061f
Fix size test build on gcc11 (#17905)
### Summary
Fix size-test on gcc11 (not a binary size improvement)
It fails with stringop-overread from flatbuffer. gcc-9 doesn't have this
and doesn't throw error.
```
In static member function ‘static constexpr std::size_t std::char_traits<char>::length(const char_type*)’,
inlined from ‘constexpr std::basic_string_view<_CharT, _Traits>::basic_string_view(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>]’ at /usr/include/c++/11/string_view:132:35,
inlined from ‘executorch::runtime::Result<void*> executorch::runtime::deserialization::getTensorDataPtr(const executorch_flatbuffer::Tensor*, const executorch::runtime::Program*, size_t, executorch::runtime::HierarchicalAllocator*, const executorch::runtime::NamedDataMap*, executorch::runtime::Span<executorch::runtime::deserialization::NamedData>)’ at /data/users/lfq/binary-size/executorch/runtime/executor/tensor_parser_exec_aten.cpp:218:41:
/usr/include/c++/11/bits/char_traits.h:399:32: error: ‘long unsigned int __builtin_strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
399 | return __builtin_strlen(__s);
| ~~~~~~~~~~~~~~~~^~~~~
In file included from /data/users/lfq/binary-size/executorch/../executorch/runtime/executor/tensor_parser.h:21,
from /data/users/lfq/binary-size/executorch/runtime/executor/tensor_parser_exec_aten.cpp:9:
/data/users/lfq/binary-size/executorch/cmake-out/schema/include/executorch/schema/program_generated.h: In function ‘executorch::runtime::Result<void*> executorch::runtime::deserialization::getTensorDataPtr(const executorch_flatbuffer::Tensor*, const executorch::runtime::Program*, size_t, executorch::runtime::HierarchicalAllocator*, const executorch::runtime::NamedDataMap*, executorch::runtime::Span<executorch::runtime::deserialization::NamedData>)’:
/data/users/lfq/binary-size/executorch/cmake-out/schema/include/executorch/schema/program_generated.h:568:8: note: at offset 5 into source object ‘executorch_flatbuffer::ExtraTensorInfo::<anonymous>’ of size 1
568 | struct ExtraTensorInfo FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
```
### Test plan
Flatbuffer should be ok - add -Wno-stringop-overread to suppress the
error. Use pragma because adding it in CXX_ARGS causes a failure, as
gcc-9 doesn't recognize it and -Werror is enabled.
size results after stripping
```
sh test/build_size_test.sh
(executorch) [lfq@devvm11764.nha0 /data/users/lfq/binary-size/executorch (binary-size)]$ ls -la cmake-out/test/size_test_all_ops
-rwxr-xr-x 1 lfq users 1670416 Mar 4 22:37 cmake-out/test/size_test_all_ops
(executorch) [lfq@devvm11764.nha0 /data/users/lfq/binary-size/executorch (binary-size)]$ ls -la cmake-out/test/size_test
-rwxr-xr-x 1 lfq users 56240 Mar 4 22:38 cmake-out/test/size_test
```
---------
Co-authored-by: Github Executorch <github_executorch@arm.com>1 parent be6b986 commit 411061f
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
162 | 170 | | |
163 | 171 | | |
164 | 172 | | |
| |||
259 | 267 | | |
260 | 268 | | |
261 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
0 commit comments