Bug 221864 - clang 5.0 crashes on assert: "replacement types must always be canonical"
Summary: clang 5.0 crashes on assert: "replacement types must always be canonical"
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Dimitry Andric
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2017-08-27 19:35 UTC by Jan Beich
Modified: 2023-05-09 17:17 UTC (History)
2 users (show)

See Also:


Attachments
src/llvm_wrapper/llvm_wrapper.cpp (preprocessed, compressed) (750.02 KB, application/x-xz)
2017-08-27 19:35 UTC, Jan Beich
no flags Details
command line args (for clang 5.0) (2.41 KB, text/plain)
2017-08-27 19:36 UTC, Jan Beich
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2017-08-27 19:35:25 UTC
Created attachment 185824 [details]
src/llvm_wrapper/llvm_wrapper.cpp (preprocessed, compressed)

$ pkg install llvm40 cmake sdl2 git
$ cd /tmp
$ git clone https://github.com/programmerjake/vulkan-cpu
$ cd vulkan-cpu
$ cmake .
$ make
[...]
[  2%] Building CXX object src/llvm_wrapper/CMakeFiles/vulkan_cpu_llvm_wrapper.dir/llvm_wrapper.cpp.o
cd /tmp/vulkan-cpu/src/llvm_wrapper && /usr/bin/CC   -I/usr/local/llvm40/include -I/tmp/vulkan-cpu/src -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -ftemplate-depth=1024 -Werror "-Wno-error=#warnings" -std=gnu++14 -o CMakeFiles/vulkan_cpu_llvm_wrapper.dir/llvm_wrapper.cpp.o -c /tmp/vulkan-cpu/src/llvm_wrapper/llvm_wrapper.cpp
Assertion failed: (Replacement.isCanonical() && "replacement types must always be canonical"), function getSubstTemplateTypeParmType, file /poudriere/jails/head-amd64/usr/src/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp, line 3520.
c++: error: unable to execute command: Abort trap
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 5.0.0 (trunk 308421) (based on LLVM 5.0.0svn)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
c++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
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/llvm_wrapper-eb0531.cpp
c++: note: diagnostic msg: /tmp/llvm_wrapper-eb0531.sh
c++: note: diagnostic msg:

********************
*** Error code 254
Comment 1 Jan Beich freebsd_committer freebsd_triage 2017-08-27 19:36:20 UTC
Created attachment 185825 [details]
command line args (for clang 5.0)

clang++40 from devel/llvm40 is not affected.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2017-08-27 19:38:32 UTC
I can still reproduce with more recent -CURRENT snapshot.

$ c++ -v
FreeBSD clang version 5.0.0 (branches/release_50 311606) (based on LLVM 5.0.0svn)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
Comment 3 Jan Beich freebsd_committer freebsd_triage 2017-08-27 19:45:05 UTC
Given devel/llvm50 port is still missing (-devel snapshot is too old to be of any use) I can't check if the issue is due to libLLVM and Clang mismatch.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2017-08-27 20:58:52 UTC
This also reproduces with upstream trunk r311836.  I'll bisect and/or minimize.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2017-08-28 11:37:14 UTC
Reported upstream: https://bugs.llvm.org/show_bug.cgi?id=34343
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:42:26 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 7 Dimitry Andric freebsd_committer freebsd_triage 2023-05-09 17:17:53 UTC
https://github.com/llvm/llvm-project/issues/33691 was finally closed, but it was fixed a while ago in clang 14.0.0.

We still use 13.0.0 in 12.4-RELEASE, but it doesn't have assertions enabled, so I think this failure should no longer occur.