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

Fix for Issue #1200 "Assertion failure" #1201

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arunkumarbhattar
Copy link
Member

@arunkumarbhattar arunkumarbhattar commented May 2, 2023

Description:
I encountered an assertion failure in the Clang compiler (Checked C branch) while compiling a Checked-C program. The assertion is triggered in the checkPointerTypesForAssignment function in SemaExpr.cpp, specifically at line 9155, where it checks if the RHSType is canonical.

Assertion `RHSType.isCanonical() && "RHS not canonicalized!"' failed.

The error message suggests submitting a bug report with the crash backtrace, preprocessed source, and associated run script. Here are the relevant details:

Crash backtrace:
clang-12: /home/arun/Desktop/nonmacro/checkedc-llvm-project/clang/lib/Sema/SemaExpr.cpp:9155: clang::Sema::AssignConvertType checkPointerTypesForAssignment(clang::Sema&, clang::QualType, clang::QualType): Assertion `RHSType.isCanonical() && "RHS not canonicalized!"' failed.

Fix Description:
added check for canonicalization as a last-ditch attempt to prevent assert error.

…rAssignment due to non-canonical RHS type"
@dtarditi
Copy link
Member

Could you supply a test case that reproduces this problem? I'm concerned that the fix, while it works, is not the right one. The function asserts that types are canonical as its first step. There is a problem where the types supplied by the calling function do not meeting this invariant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants