https://bugs.llvm.org/show_bug.cgi?id=36571

            Bug ID: 36571
           Summary: Clang crashes on assertion "Instantiated local in
                    inner and outer scopes" when invoking inner lambda
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: i...@kapsi.fi
                CC: llvm-bugs@lists.llvm.org

Created attachment 19982
  --> https://bugs.llvm.org/attachment.cgi?id=19982&action=edit
Preprocessed source and associated run script

With Clang version 4 this code compiles and runs without any problems. Thus I
think this might be an issue to be fixed.

Using Clang 7.0.d20180119 on FreeBSD 11.1

Crash backtrace:

Assertion failed: (Current->LocalDecls.find(D) == Current->LocalDecls.end() &&
"Instantiated local in inner and outer scopes"), function InstantiatedLocal,
file
/wrkdirs/usr/ports/devel/llvm-devel/work/llvm-e89505778ede40acc3920d6ff13263404b37fef0/tools/clang/lib/Sema/SemaTemplateInstantiate.cpp,
line 2921.
#0 0x0000000001e9c4e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/llvm-devel/bin/clang-7.0+0x1e9c4e8)
#1 0x0000000001e9cb06 (/usr/local/llvm-devel/bin/clang-7.0+0x1e9cb06)
#2 0x0000000805041926 (/lib/libthr.so.3+0xe926)
#3 0x0000000805040ecf (/lib/libthr.so.3+0xdecf)
Stack dump:
0.      Program arguments: /usr/local/llvm-devel/bin/clang-7.0 -cc1 -triple
x86_64-portbld-freebsd11.1 -emit-obj -mrelax-all -disable-free -main-file-name
assertion.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/llvm-devel/lib/clang/7.0.0 -internal-isystem /usr/include/c++/v1
--std=c++17 -fdeprecated-macro -fdebug-compilation-dir
/home/dev/projects/c++/meta -ferror-limit 19 -fmessage-length 112
-fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/assertion-53d8b8.o -x c++ assertion.cpp
1.      assertion.cpp:30:10: current parser token ')'
2.      assertion.cpp:27:16: parsing function body 'main'
3.      assertion.cpp:27:16: in compound statement ('{}')
4.      assertion.cpp:12:16: instantiating function definition
'chain::operator()(const (lambda at assertion.cpp:29:20), const (lambda at
assertion.cpp:29:50))::(anonymous class)::operator()<int>'
5.      assertion.cpp:13:22: instantiating function definition
'chain::operator()(const (lambda at assertion.cpp:29:20), const (lambda at
assertion.cpp:29:50))::(anonymous class)::operator()(int &)::(anonymous
class)::operator()<(lambda at assertion.cpp:13:22), (lambda at
assertion.cpp:29:20), (lambda at assertion.cpp:29:50)>'
6.      assertion.cpp:13:22: instantiating function definition
'chain::operator()(const (lambda at assertion.cpp:29:20), const (lambda at
assertion.cpp:29:50))::(anonymous class)::operator()(int &)::(anonymous
class)::operator()<(lambda at assertion.cpp:13:22), (lambda at
assertion.cpp:29:50)>'
clang-7.0: error: unable to execute command: Abort trap (core dumped)
clang-7.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0
Target: x86_64-portbld-freebsd11.1
Thread model: posix
InstalledDir: /usr/local/llvm-devel/bin
clang-7.0: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-7.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7.0: note: diagnostic msg: /tmp/assertion-530b62.cpp
clang-7.0: note: diagnostic msg: /tmp/assertion-530b62.sh
clang-7.0: note: diagnostic msg:

********************

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to