On Mon, Aug 11, 2025 at 04:21:32PM +0200, Alexander Lobakin wrote: > From: Nathan Chancellor <nat...@kernel.org> > Date: Thu, 07 Aug 2025 14:36:28 -0700 > > > After an innocuous change in -next that modified a structure that > > contains __counted_by, clang-19 start crashing when building certain > > files in drivers/gpu/drm/xe. When assertions are enabled, the more > > descriptive failure is: > > > > clang: clang/lib/AST/RecordLayoutBuilder.cpp:3335: const ASTRecordLayout > > &clang::ASTContext::getASTRecordLayout(const RecordDecl *) const: Assertion > > `D && "Cannot get layout of forward declarations!"' failed. > > > > According to a reverse bisect, a tangential change to the LLVM IR > > generation phase of clang during the LLVM 20 development cycle [1] > > resolves this problem. Bump the version of clang that enables > > CONFIG_CC_HAS_COUNTED_BY to 20.1.0 to ensure that this issue cannot be > > hit. > > Any chance for this to go to the next 19.x (if it's planned at all)? > I always use the latest HEAD from llvm-project, but 19 is still widely > used across distros etc =\
Unfortunately not, LLVM does not maintain more than one branch at a time, so LLVM 19 has been unsupported since LLVM 20.1.0-rc1 was released back in February :/ Some distros may be willing to patch that in but there is not really a good way for us to check for that here, so I am not sure it helps much. Kees and Bill may have thoughts around working around this in the one spot we know it happens but in my opinion, I would rather do the big hammer. The deployment of __counted_by in the kernel is only growing so it is totally possible for us to fix this one instance then run into another case in a few months, which is more painful for clang than GCC since it has been supported for a bigger number of releases. Cheers, Nathan