Skip to content

Fix for Issue #1200 "Assertion failure"#1201

Open
arunkumarbhattar wants to merge 1 commit intocheckedc:mainfrom
checkedc-purdue:main
Open

Fix for Issue #1200 "Assertion failure"#1201
arunkumarbhattar wants to merge 1 commit intocheckedc:mainfrom
checkedc-purdue:main

Conversation

@arunkumarbhattar
Copy link
Copy Markdown
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
Copy Markdown
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