Bug 241747 - security/openssl111: Clang crashes building on 13.0-CURRENT (r354143): Assertion failed: (isSimple() && "Expected a SimpleValueType!"), function getSimpleVT
Summary: security/openssl111: Clang crashes building on 13.0-CURRENT (r354143): Assert...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords: crash, toolchain
Depends on:
Blocks:
 
Reported: 2019-11-06 02:58 UTC by Kubilay Kocak
Modified: 2020-03-01 21:32 UTC (History)
4 users (show)

See Also:
koobs: maintainer-feedback+
koobs: mfc-stable12?
koobs: mfc-stable11?


Attachments
security-openssl111-clang.tar.gz (165.71 KB, application/gzip)
2019-11-06 02:58 UTC, Kubilay Kocak
no flags Details
dmesg.boot (4.51 KB, text/plain)
2019-11-06 04:39 UTC, Kubilay Kocak
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kubilay Kocak freebsd_committer freebsd_triage 2019-11-06 02:58:13 UTC
Created attachment 208902 [details]
security-openssl111-clang.tar.gz

security/openssl111 fails to build on 13.0-CURRENT r354143 with error:

Assertion failed: (isSimple() && "Expected a SimpleValueType!"), function getSimpleVT, file /usr/src/contrib/llvm/include/llvm/CodeGen/ValueTypes.h, line 253.

- Latest ports tree, default port OPTIONS
- DEFAULT_VERSIONS=       perl5=5.30 ssl=openssl111 python=2.7
- make.conf:

CPUTYPE?=       corei7-avx

.if !empty(.CURDIR:M/*/ports/*)
CFLAGS=         -O2 -pipe -fcolor-diagnostics
SSP_CFLAGS=     -fstack-protector-strong
.endif


Build log tail/backtrace, sources and script attached
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-06 03:07:49 UTC
Also found bug 213865 and the following freebsd-multimedia thread which looks similar:

https://lists.freebsd.org/pipermail/freebsd-multimedia/2018-November/019343.html
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-06 04:39:24 UTC
Created attachment 208904 [details]
dmesg.boot

Isolation tests:

- Commenting out CPUTYPE?=corei7-avx (all else the same) results in a successful build, / no assertion error.

- Removing -O2 (leaving CPUTYPE?=corei7-avx, and all else the same) results in a successful build / no assertion error.

- Using -O1 (leaving CPUTYPE?=corei7-avx, and all else the same) results in a successful build / no assertion error.

- Changing CPUTYPE?=corei7-avx -> sandybridge (all else the same), results in assertion error

Additional environment information:

- CPU: Intel Core i7-2600K
- FreeBSD is VirtualBox guest (dmest.boot attached)
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2019-11-06 12:18:40 UTC
Reproduced and reported upstream: https://bugs.llvm.org/show_bug.cgi?id=43916
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-11-07 06:59:51 UTC
A commit references this bug:

Author: dim
Date: Thu Nov  7 06:59:10 UTC 2019
New revision: 354429
URL: https://svnweb.freebsd.org/changeset/base/354429

Log:
  Merge commit 8e34dd941 from llvm git (by Sanjay Patel):

    [x86] avoid crashing when splitting AVX stores with non-simple type
    (PR43916)

    The store splitting transform was assuming a simple type (MVT), but
    that's not necessarily the case as shown in the test.

  This should fix 'Assertion failed: (isSimple() && "Expected a
  SimpleValueType!")' when building the security/openssl111 port targeting
  a CPU that supports AVX, but not AVX2, such as sandybridge.

  PR:		241747
  MFC after:	1 month
  X-MFC-With:	r353358

Changes:
  head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-07 11:16:57 UTC
Thank you Dimitry

Any workarounds/changes that can be made to openssl111 in the meantime?
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2019-11-07 11:59:24 UTC
(In reply to Kubilay Kocak from comment #5)

Yes, just make sure the CPU type is not set, or set to something other than: sandybridge, core-avx-i or corei7-avx.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-07 12:03:28 UTC
Thanks Dimitry :)

Will leave this in progress pending MFC
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-07 12:04:52 UTC
If MFC is not required in stable/11 (due to it being a recent regression), just set the flag value to -
Comment 9 Dimitry Andric freebsd_committer freebsd_triage 2020-03-01 21:32:04 UTC
This got fixed for stable/12 with the MFC of clang 9.0.1.