Fix segmentation fault when processing assert statements
Resolves issue #1442 where Clad would crash with a segfault when differentiating functions containing assert statements. The crash occurred in ReferencesUpdater::updateType() when processing SourceLocExpr nodes that return null QualType values.
Changes:
- Add null checks in ReferencesUpdater::VisitStmt() before calling updateType()
- Add defensive null check in ReferencesUpdater::VisitDeclRefExpr() for consistency
- Add test case to prevent regression
Fixes #1442
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
@mohsinm-dev, it seems we are almost ready to go. We need to capture the warning that comes with the test cases as an expected warning...
@mohsinm-dev, it seems we are almost ready to go. We need to capture the warning that comes with the test cases as an expected warning...
Yes, are these warnings the reason for failed workflows? Let me know what we have to do. I'll look into it.
clang-tidy review says "All clean, LGTM! :+1:"
@mohsinm-dev, it seems we are almost ready to go. We need to capture the warning that comes with the test cases as an expected warning...
Yes, are these warnings the reason for failed workflows? Let me know what we have to do. I'll look into it.
I've adjusted the test for osx, however, it looks like the current fix is not enough for ubuntu. Can you take a look?
clang-tidy review says "All clean, LGTM! :+1:"
Your last push undid the changes I made to your branch to fix osx.
Your last push undid the changes I made to your branch to fix osx.
Yes, I was trying something. I am working on it. Will push the updates soon. Hopefully that will resolve it.
Your last push undid the changes I made to your branch to fix osx.
Yes, I was trying something. I am working on it. Will push the updates soon. Hopefully that will resolve it.
If you need to debug the runners here is how: https://clad.readthedocs.io/en/latest/user/DevelopersDocumentation.html#debugging-github-runners
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"
Your last push undid the changes I made to your branch to fix osx.
Yes, I was trying something. I am working on it. Will push the updates soon. Hopefully, that will resolve it.
If you need to debug the runners here is how: https://clad.readthedocs.io/en/latest/user/DevelopersDocumentation.html#debugging-github-runners
Can you guide me a bit? I tried running the debugger, but was unable to connect. I guess there might be some internal fixes that need to be done. I am looking into that and debugging it. Probably will try to wrap up this weekend.
clang-tidy review says "All clean, LGTM! :+1:"
Ok, we are getting there. Newer versions fail because it seems we might not be handling properly the PredefinedExpr expression kind. Perhaps you can build locally a newer version of clang and debug?
Ok, we are getting there. Newer versions fail because it seems we might not be handling properly the PredefinedExpr expression kind. Perhaps you can build locally a newer version of clang and debug?
You're right about the PredefinedExpr issue. I found that __func__, __FUNCTION__, and __PRETTY_FUNCTION__ return null QualType values, causing segfaults in CloneType(). Fixed by adding null check, also updated the test to cover PredefinedExpr cases.
clang-tidy review says "All clean, LGTM! :+1:"
clang-tidy review says "All clean, LGTM! :+1:"