Skip to content

Segfault with performance-unnecessary-value-param check #45855

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

Closed
varqox opened this issue Jun 30, 2020 · 4 comments
Closed

Segfault with performance-unnecessary-value-param check #45855

varqox opened this issue Jun 30, 2020 · 4 comments
Labels
bugzilla Issues migrated from bugzilla clang-tidy confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@varqox
Copy link

varqox commented Jun 30, 2020

Bugzilla Link 46510
Version unspecified
OS Linux
CC @EugeneZelenko,@fberger,@irishrover

Extended Description

Running
clang-tidy -checks='performance-unnecessary-value-param' bug.cc
on the following code results in a segfault:

struct Foo {
Foo(const Foo&) {}
};

template
bool recur(unsigned x, T&& val) {
if (x == 0) {
return false;
}
return recur(x / 2, val);
}

void bar(Foo entry) {
recur(0, entry);
}

Both clang 10.0.0 and current trunk (clang 11) segfault (see https://godbolt.org/z/gzVMqr).

@irishrover
Copy link
Contributor

It hangs inside ExprMutationAnalyzer trying to analyze a recursive function again and again.

@irishrover
Copy link
Contributor

Simple workaround is to replace

Foo(const Foo&) {}
--->
Foo(const Foo&) = default;

@varqox
Copy link
Author

varqox commented Jul 13, 2020

Simple workaround is to replace

Foo(const Foo&) {}
--->
Foo(const Foo&) = default;

Thank you for noting that.
I tried to make the example as small as possible -- in the original code copy constructor wasn't trivial iirc.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@carlosgalvezp carlosgalvezp added confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid] labels Apr 6, 2023
@5chmidti
Copy link
Contributor

This no longer reproduces, and has probably been fixed by #87954, which is part of LLVM19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy confirmed Verified by a second party crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants