Bug 257876

Summary: clang-11.0.1 crashes on 14-CURRENT but doesn't crash on 13.0-STABLE on the math/deal.ii port: error: Didn't find this decl on its identifier's chain!
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: binAssignee: freebsd-toolchain (Nobody) <toolchain>
Status: Open ---    
Severity: Affects Only Me CC: dim, marklmi26-fbsd
Priority: --- Keywords: regression
Version: 13.0-STABLE   
Hardware: Any   
OS: Any   
URL: https://github.com/llvm/llvm-project/issues/47050
See Also: https://bugs.llvm.org/show_bug.cgi?id=47706

Description Yuri Victorovich freebsd_committer freebsd_triage 2021-08-15 23:04:18 UTC
The attached testcase crashes on 14-CURRENT with
> Didn't find this decl on its identifier chain!

The same clang version succeeds on 13.0-STABLE.

The port math/deal.ii (6e7b82f0665c904d2859d9361d66aa4085c5a54e) fails on 14-CURRENT with this error.
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2021-08-15 23:06:15 UTC
Testcase: https://people.freebsd.org/~yuri/clang-testcase.tar.xz
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2021-08-15 23:29:04 UTC
[ 86%] Building CXX object source/grid/CMakeFiles/obj_grid_release.dir/grid_generator.cc.o
cd /wrkdirs/usr/ports/math/deal.ii/work/.build/source/grid && /usr/bin/c++ -DBOOST_NO_AUTO_PTR -I/wrkdirs/usr/ports/math/deal.ii/work/.build/source/grid -I/wrkdirs/usr/ports/math/deal.ii/work/.build/include -I/wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/include -isystem /usr/local/include -pedantic -fPIC -Wall -Wextra -Wmissing-braces -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wsuggest-override -Wswitch -Wsynth -Wwrite-strings -Wno-deprecated-declarations -Wno-psabi -Wfloat-conversion -Qunused-arguments -Wno-unsupported-friend -Wno-undefined-var-template -openmp-simd -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -Wno-unused-local-typedefs -funroll-loops -fstrict-aliasing -MD -MT source/grid/CMakeFiles/obj_grid_release.dir/grid_generator.cc.o -MF CMakeFiles/obj_grid_release.dir/grid_generator.cc.o.d -o CMakeFiles/obj_grid_release.dir/grid_generator.cc.o -c /wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/source/grid/grid_g!
 enerator.
 cc
Didn't find this decl on its identifier's chain!
UNREACHABLE executed at /usr/local/poudriere/jails/main-i386/usr/src/contrib/llvm-project/clang/lib/Sema/IdentifierResolver.cpp:82!
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /usr/bin/c++ -DBOOST_NO_AUTO_PTR -I/wrkdirs/usr/ports/math/deal.ii/work/.build/source/grid -I/wrkdirs/usr/ports/math/deal.ii/work/.build/include -I/wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/include -isystem /usr/local/include -pedantic -fPIC -Wall -Wextra -Wmissing-braces -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wsuggest-override -Wswitch -Wsynth -Wwrite-strings -Wno-deprecated-declarations -Wno-psabi -Wfloat-conversion -Qunused-arguments -Wno-unsupported-friend -Wno-undefined-var-template -openmp-simd -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -Wno-unused-local-typedefs -funroll-loops -fstrict-aliasing -MD -MT source/grid/CMakeFiles/obj_grid_release.dir/grid_generator.cc.o -MF CMakeFiles/obj_grid_release.dir/grid_generator.cc.o.d -o CMakeFiles/obj_grid_release.dir/grid_generator.cc.o -c /wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/source/grid/grid_generator.cc
1.	/wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/source/grid/grid_generator.cc:6106:3: current parser token 'template'
2.	/wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/source/grid/grid_generator.cc:36:1 <Spelling=/wrkdirs/usr/ports/math/deal.ii/work/.build/include/deal.II/base/config.h:396:32>: parsing namespace 'dealii'
3.	/wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/source/grid/grid_generator.cc:42:1: parsing namespace 'dealii::GridGenerator'
4.	/wrkdirs/usr/ports/math/deal.ii/work/dealii-9.3.1/source/grid/grid_generator.cc:5898:3: parsing function body 'dealii::GridGenerator::hyper_shell<3>'
#0 0x0450d6c4 (/usr/bin/c+++0x450d6c4)
#1 0x0450db40 (/usr/bin/c+++0x450db40)
#2 0x0450b77e (/usr/bin/c+++0x450b77e)
#3 0x044a7024 (/usr/bin/c+++0x44a7024)
#4 0x044a71c4 (/usr/bin/c+++0x44a71c4)
#5 0x25b84709 (/lib/libthr.so.3+0x18709)
c++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
FreeBSD clang version 12.0.1 (git@github.com:llvm/llvm-project.git llvmorg-12.0.1-0-gfed41342a82f)
Target: i386-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
c++: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
c++: note: diagnostic msg: /tmp/grid_generator-ae2fdb.cpp
c++: note: diagnostic msg: /tmp/grid_generator-ae2fdb.sh
c++: note: diagnostic msg:
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2021-08-15 23:33:13 UTC
The log above is for clang-12.0.1 but I have an older 14-CURRENT VM with clang-11.0.1 which crashes the same way.
Comment 4 Mark Millard 2021-08-16 01:05:39 UTC
The:

Version:	13.0-STABLE

seems to be indicating that context that does not fail?
It probably should be chnaged to indicate that context
that does get the failure.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2021-08-16 17:51:24 UTC
I can reproduce on 14.0 with clang 12.0.1; at first sight it looks like a new bug for upstream. It will take a bit of time to reduce, as compiling this file is very slow.
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2021-08-17 13:15:47 UTC
This was already reported upstream on 2020-10-01 as https://bugs.llvm.org/show_bug.cgi?id=47706, no fix yet. :(