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

clang-tidy SEGFAULT on bugprone-unchecked-optional-access #97426

Open
andy31415 opened this issue Jul 2, 2024 · 2 comments
Open

clang-tidy SEGFAULT on bugprone-unchecked-optional-access #97426

andy31415 opened this issue Jul 2, 2024 · 2 comments
Labels
clang-tidy crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@andy31415
Copy link

I have somewhat template-heavy C++ source file that uses std::optional among other things. I seem to get a segfault on clang-tidy 18.1.3.

Stack trace attached.

tidy_segfault_trace.txt

@andy31415
Copy link
Author

Underlying reason may be that we have a wrapper class for std::optional (because historical reasons) so something named chip::Nullable is actually a std::optional with a set of renamed methods e.g. Value is std::optional::value. This seems to make clang-tidy unhappy.

@firewave firewave added the crash Prefer [crash-on-valid] or [crash-on-invalid] label Jul 2, 2024
tcarmelveilleux added a commit to tcarmelveilleux/connectedhomeip that referenced this issue Jul 10, 2024
@andy31415
Copy link
Author

2nd crash in the code from Tennessee is similar: using the chip class Nullable : protected std::optional<T> causes clang-tidy segfaults. That code path seems to be smaller than what I had, so there is a better chance to create some stand-alone reproduction case.

mergify bot pushed a commit to project-chip/connectedhomeip that referenced this issue Jul 10, 2024
* Introduce a building block usable for all Q attributes

- Q quality requires marking attributes as dirty for the purposes of reporting
  only when certain conditions arise.
- This PR introduces a building block attribute value wrapper compatible with
  any nullable or non-nullable numerical attribute, which allows applying
  the necessary policies, and all complex policies that currently exist in the
  Matter spec (e.g. any CountdownTime, CurrentLevel, etc).

Testing done:

- Added unit tests. Integration in existing clusters will follow in a different
  PR.

* Reword examples

* Restyled by clang-format

* Address review comments

* Restyled by clang-format

* Restyled by gn

* Address more review comments

* Restyled by clang-format

* Add clang-tidy exclusion due to clang-tidy bug

See llvm/llvm-project#97426

* Apply review comments

* Restyled by clang-format

* Fix Darwin clang-tidy crash by adding an override

---------

Co-authored-by: Restyled.io <[email protected]>
j-ororke pushed a commit to j-ororke/connectedhomeip that referenced this issue Jul 18, 2024
…34266)

* Introduce a building block usable for all Q attributes

- Q quality requires marking attributes as dirty for the purposes of reporting
  only when certain conditions arise.
- This PR introduces a building block attribute value wrapper compatible with
  any nullable or non-nullable numerical attribute, which allows applying
  the necessary policies, and all complex policies that currently exist in the
  Matter spec (e.g. any CountdownTime, CurrentLevel, etc).

Testing done:

- Added unit tests. Integration in existing clusters will follow in a different
  PR.

* Reword examples

* Restyled by clang-format

* Address review comments

* Restyled by clang-format

* Restyled by gn

* Address more review comments

* Restyled by clang-format

* Add clang-tidy exclusion due to clang-tidy bug

See llvm/llvm-project#97426

* Apply review comments

* Restyled by clang-format

* Fix Darwin clang-tidy crash by adding an override

---------

Co-authored-by: Restyled.io <[email protected]>
erwinpan1 pushed a commit to erwinpan1/connectedhomeip that referenced this issue Nov 11, 2024
…34266)

* Introduce a building block usable for all Q attributes

- Q quality requires marking attributes as dirty for the purposes of reporting
  only when certain conditions arise.
- This PR introduces a building block attribute value wrapper compatible with
  any nullable or non-nullable numerical attribute, which allows applying
  the necessary policies, and all complex policies that currently exist in the
  Matter spec (e.g. any CountdownTime, CurrentLevel, etc).

Testing done:

- Added unit tests. Integration in existing clusters will follow in a different
  PR.

* Reword examples

* Restyled by clang-format

* Address review comments

* Restyled by clang-format

* Restyled by gn

* Address more review comments

* Restyled by clang-format

* Add clang-tidy exclusion due to clang-tidy bug

See llvm/llvm-project#97426

* Apply review comments

* Restyled by clang-format

* Fix Darwin clang-tidy crash by adding an override

---------

Co-authored-by: Restyled.io <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-tidy crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

2 participants