This is an archive of the discontinued LLVM Phabricator instance.

[AST] Add RParen loc for decltype AutoTypeloc.
ClosedPublic

Authored by hokein on Jan 10 2022, 1:00 AM.

Diff Detail

Event Timeline

hokein created this revision.Jan 10 2022, 1:00 AM
hokein requested review of this revision.Jan 10 2022, 1:00 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJan 10 2022, 1:00 AM
sammccall accepted this revision.Jan 10 2022, 1:21 AM
This revision is now accepted and ready to land.Jan 10 2022, 1:21 AM
This revision was landed with ongoing or failed builds.Jan 10 2022, 3:56 AM
This revision was automatically updated to reflect the committed changes.

Looks like this breaks tests: http://45.33.8.238/linux/64726/step_8.txt

sorry, looking.

The relanded version in rG41fbdfa4d5601cccbcdc0ded8ef35190d502f7f3 seems to be breaking some builds with PCH for me, failing asserts like this:

clang: ../tools/clang/include/clang/Basic/SourceLocation.h:135: clang::SourceLocation clang::SourceLocation::getLocWithOffset(clang::SourceLocation::IntTy) const: Assertion `((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"' failed.
fhahn added a subscriber: fhahn.Jan 12 2022, 2:13 AM

The relanded version in rG41fbdfa4d5601cccbcdc0ded8ef35190d502f7f3 seems to be breaking some builds with PCH for me, failing asserts like this:

clang: ../tools/clang/include/clang/Basic/SourceLocation.h:135: clang::SourceLocation clang::SourceLocation::getLocWithOffset(clang::SourceLocation::IntTy) const: Assertion `((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"' failed.

This also breaks stage2 builds with debug info, e.g. https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/5088/console

Given that the bot has been red a while now, I reverted the commit eadb4cfeeff5 for now.

The crash should be reproducible when doing a stage2 build with debug info. It crashes, e.g. when building llvm-project/llvm/lib/Support/Timer.cpp

 /Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/host-compiler/bin/clang++  -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/lib/Support -Iinclude -I/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/include -fno-stack-protector -fno-common -Wno-profile-instr-unprofiled -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -fmodules -fmodules-cache-path=/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/clang-build/Build/module.cache -fcxx-modules -Xclang -fmodules-local-submodule-visibility -gmodules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -flto=thin  -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk   -std=c++14  -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o -c /Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/lib/Support/Timer.cpp
Assertion failed: (((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"), function getLocWithOffset, file /Users/buildslave/jenkins/workspace/clang-stage1-RA/llvm-project/clang/include/clang/Basic/SourceLocation.h, line 135.

The relanded version in rG41fbdfa4d5601cccbcdc0ded8ef35190d502f7f3 seems to be breaking some builds with PCH for me, failing asserts like this:

clang: ../tools/clang/include/clang/Basic/SourceLocation.h:135: clang::SourceLocation clang::SourceLocation::getLocWithOffset(clang::SourceLocation::IntTy) const: Assertion `((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"' failed.

Thanks for raising this. It would be great if you can provide a reproduce case and a more detailed log. A failed PCH build usually indicates something wrong around the ASTReader/ASTWriter code, but I didn't spot out any issue there. At the mean time, I will try to investigate it.

Ok, now I managed to make a standalone reproducer: https://martin.st/temp/pch-preproc.hxx and https://martin.st/temp/main-preproc.cpp

$ bin/clang -target x86_64-w64-mingw32 -w -x c++-header -c pch-preproc.hxx -o pch-preproc.hxx.pch -std=c++17 -O3
$ bin/clang -target x86_64-w64-mingw32 -w -Xclang -include-pch -Xclang pch-preproc.hxx.pch -c main-preproc.cpp -std=c++17 -O3

Since this is changing serialization format you might have to do something like https://reviews.llvm.org/rGb8b7a9dcdcbc as well (see https://reviews.llvm.org/D73202 for background). I doubt that's the cause of mstorsjo's repro given that LLVM_APPEND_VC_REV is on by default, but it seems like a good thing to do in the reland regardless.

(We also saw this crash on chromium's bots, https://crbug.com/1286675. Thanks for the revert, and for the reduced repro!)

Thanks, everyone!

I manage to figure out the cause, the crash was caused by an arbitrary RPareLoc -- we missed to set the RPareLoc in TreeTransform::TransformAutoType. I reland the patch in ab3f100bec03d72ecee947a323c51698d4b95207.

Thanks, everyone!

I manage to figure out the cause, the crash was caused by an arbitrary RPareLoc -- we missed to set the RPareLoc in TreeTransform::TransformAutoType. I reland the patch in ab3f100bec03d72ecee947a323c51698d4b95207.

I rebuilt my full, non-reduced testcase now, and it seems like it built fine this time. Thanks!

Thanks, everyone!

I manage to figure out the cause, the crash was caused by an arbitrary RPareLoc -- we missed to set the RPareLoc in TreeTransform::TransformAutoType. I reland the patch in ab3f100bec03d72ecee947a323c51698d4b95207.

I rebuilt my full, non-reduced testcase now, and it seems like it built fine this time. Thanks!

Glad to hear, and thanks for the verification!