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 17 upgrade: remaining 3C failing tests #1209

Open
dtarditi opened this issue Oct 2, 2024 · 2 comments
Open

clang 17 upgrade: remaining 3C failing tests #1209

dtarditi opened this issue Oct 2, 2024 · 2 comments
Assignees

Comments

@dtarditi
Copy link
Member

dtarditi commented Oct 2, 2024

With this PR, there are 6 failing 3C test cases:

  Clang :: 3C/3d-allocation.c
  Clang :: 3C/function_typedef.c
  Clang :: 3C/itype_nt_arr_cast.c
  Clang :: 3C/itype_undef.c
  Clang :: 3C/prototype_success1.c
  Clang :: 3C/prototype_success2.c
  Clang :: 3C/valist.c

I debugged 3C/prototype_success2.c, which is oddly compiled when you run the 3C\prototype_success1.c test. The 3C failure is due to trying to get a source location for a compiler-generated variable declaration. The test case that triggers the failures shows the problem:

_Ptr<int> foo(int *, char);

In the prototype declaration, only the types of the arguments are declared. The compiler generates a variable declaration. When 3C tries to fetch the source code location, an assert happens.

Here's a partial call stack. This is on Windows using the VS Studio debugger:

>	3c.exe!HandleAbort(int Sig) Line 415	C++
 	[External Code]	
 	3c.exe!clang::SourceManager::getFileIDLoaded(unsigned int SLocOffset) Line 868	C++
 	3c.exe!clang::SourceManager::getFileIDSlow(unsigned int SLocOffset) Line 779	C++
 	3c.exe!clang::SourceManager::getFileID(unsigned int SLocOffset) Line 1831	C++
 	3c.exe!clang::SourceManager::getFileID(clang::SourceLocation SpellingLoc) Line 1120	C++
 	3c.exe!clang::SourceManager::getExpansionLocSlowCase(clang::SourceLocation Loc) Line 946	C++
 	3c.exe!clang::SourceManager::getExpansionLoc(clang::SourceLocation Loc) Line 1172	C++
 	3c.exe!PersistentSourceLoc::mkPSL(clang::SourceRange SR, clang::SourceLocation SL, const clang::ASTContext & Context) Line 61	C++
 	3c.exe!PersistentSourceLoc::mkPSL(const clang::Decl * D, const clang::ASTContext & C) Line 26	C++
 	3c.exe!MappingVisitor::VisitDecl(clang::Decl * D) Line 18	C++
 	3c.exe!clang::RecursiveASTVisitor<MappingVisitor>::WalkUpFromDecl(clang::Decl * D) Line 440	C++
 	3c.exe!clang::RecursiveASTVisitor<MappingVisitor>::WalkUpFromNamedDecl(clang::NamedDecl * D) Line 107	C++

@souragc
Copy link
Member

souragc commented Oct 4, 2024

Hi David,

I cloned this repo's branch 17-init-main and tried running the 3C tests. I am only getting two tests which are failing. Can you post the commit on which you got the above results? Also, it looked like this repo is missing a change to the CMakeLists.txt from the 17-init-main branch of the archived fork. So I used the archive during my building. Please let me know if I should be building differently.

@dtarditi
Copy link
Member Author

dtarditi commented Oct 7, 2024

Hi Sourag,

Thanks for pointing out there was an issue with the checkedc repo. It didn't have the 17-init-main branch from the archive. I have pushed that branch to the checkedc repo. I merged the most recent changes from main into the 17-init-main branch also.

For the 3C tests, I did a debug build on x64 Windows. I used this cmake command:

cmake -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Debug c:\checkedc\checkedc-clang\llvm

followed by

ninja checked-clang

It could be the type of build or that platform that is causing the difference. Note that running checked-clang with a debug build is quite slow. It takes over an hour on my test system.

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

No branches or pull requests

3 participants