Issue 989 in include-what-you-use: Segmentation fault after upgrade to 0.17 on macOS 11.6.2

0 views
Skip to first unread message

notifi...@include-what-you-use.org

unread,
Jan 3, 2022, 8:00:49 AM1/3/22
to include-wh...@googlegroups.com
New issue 989 by srpgilles: Segmentation fault after upgrade to 0.17 on macOS 11.6.2
https://github.com/include-what-you-use/include-what-you-use/issues/989

After upgrading to IWYU 0.17 on my BigSur installation (within Homebrew), IWYU stopped working on my codebase due to some pesky segmentation fault.

By trial and error on one file that was segmenting I was able to reduce to a small snippet that cause the segmentation fault:

````
#include <algorithm>
#include <cassert>
#include <vector>

int main()
{
constexpr auto unused = static_cast<std::size_t>(-1);
const auto Ndof = 100ul;

std::vector<std::size_t> mapping(Ndof, unused);

assert(std::none_of(mapping.cbegin(),
mapping.cend(),
[](auto value)
{
return value == unused;
}));

return EXIT_SUCCESS;
}
````

This segmentation fault is highly specific:

- If the algorithm is not inside the `assert` command, no segmentation fault.
- If I declare the lambda as a variable `auto is_unused = [](auto value) {... } ` and then use `is_unused` in the `std::none` algorithm, no segmentation fault.

Before the upgrade to newest IWYU (LLVM was also upgraded - I did it through `brew upgrade`), IWYU was working on my entire codebase without issue.


notifi...@include-what-you-use.org

unread,
Jan 3, 2022, 8:48:11 AM1/3/22
to include-wh...@googlegroups.com
Comment #0 on issue 989 by srpgilles: Segmentation fault after upgrade to 0.17 on macOS 11.6.2
https://github.com/include-what-you-use/include-what-you-use/issues/989

I tried reinstalling 0.16 to check: the code abode works perfectly fine.


notifi...@include-what-you-use.org

unread,
Jan 3, 2022, 8:48:18 AM1/3/22
to include-wh...@googlegroups.com
Comment #1 on issue 989 by srpgilles: Segmentation fault after upgrade to 0.17 on macOS 11.6.2
https://github.com/include-what-you-use/include-what-you-use/issues/989

I tried reinstalling 0.16 to check: the code above works perfectly fine.


notifi...@include-what-you-use.org

unread,
Jan 6, 2022, 7:07:31 AM1/6/22
to include-wh...@googlegroups.com
Comment #1 on issue 989 by kimgr: Segmentation fault after upgrade to 0.17 on macOS 11.6.2
https://github.com/include-what-you-use/include-what-you-use/issues/989

Thanks for the reduced repro! Unfortunately it seems to work fine on my Ubuntu/libstdc++-gcc9.3 setup. The main difference is that macOS has libc++ by default, so the standard library implementation probably triggers some path not seen with libstdc++.

Can you get a backtrace for the segfault?


Reply all
Reply to author
Forward
0 new messages