Bug 234232 - clang Assertion failed when building the port devel/aws-checksums
Summary: clang Assertion failed when building the port devel/aws-checksums
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-toolchain mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-20 22:18 UTC by Danilo Egea Gondolfo
Modified: 2019-09-05 12:07 UTC (History)
1 user (show)

See Also:
koobs: mfc-stable11?
koobs: mfc-stable12?


Attachments
crc32c_sse42_asm-43f9ae.c (86.93 KB, text/plain)
2018-12-20 22:19 UTC, Danilo Egea Gondolfo
no flags Details
crc32c_sse42_asm-43f9ae.sh (2.53 KB, application/x-shellscript)
2018-12-20 22:19 UTC, Danilo Egea Gondolfo
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Danilo Egea Gondolfo freebsd_committer 2018-12-20 22:18:18 UTC
Clang is segfaulting on CURRENT when building devel/aws-checksums.

It stops at this assertion:

Assertion failed: (i == DstIdx || !MI->getOperand(i).isReg() || MI->getOperand(i).getReg() != RegA), function processTiedPairs, file /usr/src/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp, line 1544.

TwoAddressInstructionPass.cpp:1544.
#ifndef NDEBUG
    // First, verify that we don't have a use of "a" in the instruction
    // (a = b + a for example) because our transformation will not
    // work. This should never occur because we are in SSA form.
    for (unsigned i = 0; i != MI->getNumOperands(); ++i)
      assert(i == DstIdx ||
             !MI->getOperand(i).isReg() ||
             MI->getOperand(i).getReg() != RegA);
#endif

The target file (source/intel/crc32c_sse42_asm.c) has a lot of assembly inline code.
Comment 1 Danilo Egea Gondolfo freebsd_committer 2018-12-20 22:19:22 UTC
Created attachment 200322 [details]
crc32c_sse42_asm-43f9ae.c
Comment 2 Danilo Egea Gondolfo freebsd_committer 2018-12-20 22:19:55 UTC
Created attachment 200323 [details]
crc32c_sse42_asm-43f9ae.sh
Comment 3 Jan Beich freebsd_committer 2019-03-04 13:37:54 UTC
Also affects Clang 8 (soon to be in -CURRENT).

$ poudriere jail -cj clang8 -v projects/clang800-import -m svn+https
$ poudriere testport -j clang8 devel/aws-checksums
[...]
Assertion failed: (i == DstIdx || !MI->getOperand(i).isReg() || MI->getOperand(i).getReg() != RegA), function processTiedPairs, file /poudriere/jails/headamd64PR236062/usr/src/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp, line 1547.
cc: error: unable to execute command: Abort trap (core dumped)
cc: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 8.0.0 (branches/release_80 354799) (based on LLVM 8.0.0)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

http://package18.nyi.freebsd.org/data/headamd64PR236062-default/2019-03-01_06h42m53s/logs/errors/aws-checksums-0.1.2,1.log
Comment 4 Dimitry Andric freebsd_committer 2019-03-06 18:32:47 UTC
This reproduces even with very old versions of clang, e.g. it has been in there for a long time; though assertions need to be enabled.

Minimized and submitted upstream here:
https://bugs.llvm.org/show_bug.cgi?id=40985
Comment 5 Baptiste Daroussin freebsd_committer 2019-09-05 12:07:23 UTC
Remove the blocking against 230355 as llvm/clang 7 has landed already