Bug 236566 - java/openjdk8: clang 8 crashes during build on aarch64 and armv7 (blocks 647 ports)
Summary: java/openjdk8: clang 8 crashes during build on aarch64 and armv7 (blocks 647 ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords: crash
Depends on:
Blocks: 236062
  Show dependency treegraph
 
Reported: 2019-03-16 02:44 UTC by Jan Beich
Modified: 2019-11-25 01:21 UTC (History)
8 users (show)

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


Attachments
instanceKlass.cpp (compressed, preprocessed) (929.72 KB, application/x-xz)
2019-03-16 02:46 UTC, Jan Beich
no flags Details
command line args (for clang 8) (7.70 KB, text/plain)
2019-03-16 02:46 UTC, Jan Beich
no flags Details
jdk-use-ports-clang.patch (655 bytes, patch)
2019-04-21 19:47 UTC, Val Packett
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2019-03-16 02:44:51 UTC
$ poudriere jail -cj head-aarch64 -x -a arm64.aarch64 -v head -m svn+https
$ poudriere testport -j head-aarch64 java/openjdk8
[...]
Compiling /usr/ports/java/openjdk8/work/openjdk/hotspot/src/share/vm/oops/instanceKlass.cpp
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255.
c++: error: unable to execute command: Abort trap (core dumped)
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 8.0.0 (branches/release_80 355677) (based on LLVM 8.0.0)
Target: aarch64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

http://thunderx1.nyi.freebsd.org/data/head-arm64-default/p495404_s345044/logs/errors/openjdk8-8.202.8.log
Comment 1 Jan Beich freebsd_committer freebsd_triage 2019-03-16 02:46:02 UTC
Created attachment 202897 [details]
instanceKlass.cpp (compressed, preprocessed)
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-03-16 02:46:33 UTC
Created attachment 202898 [details]
command line args (for clang 8)
Comment 3 Jan Beich freebsd_committer freebsd_triage 2019-03-16 02:59:44 UTC
Ditto armv7.

$ poudriere jail -cj head-armv7 -x -a arm.armv7 -v head -m svn+https
$ poudriere testport -j head-armv7 java/openjdk8
[...]
Compiling /usr/ports/java/openjdk8/work/openjdk/hotspot/src/share/vm/oops/instanceKlass.cpp
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255.
c++: error: unable to execute command: Abort trap (core dumped)
c++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 8.0.0 (branches/release_80 355677) (based on LLVM 8.0.0)
Target: armv7-unknown-freebsd13.0-gnueabihf
Thread model: posix
InstalledDir: /usr/bin

http://www.ipv6proxy.net/go.php?u=http://beefy16.nyi.freebsd.org/data/head-armv7-default/p495681_s345110/logs/errors/openjdk8-8.202.8.log
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2019-03-17 22:18:00 UTC
Reproduced, minimized and submitted upstream here:

https://bugs.llvm.org/show_bug.cgi?id=41117
Comment 5 Val Packett 2019-04-21 19:47:36 UTC
Created attachment 203870 [details]
jdk-use-ports-clang.patch

For now it's possible to use clang from ports, which has assertions disabled (as it should be — LLVM officially does not enable them in production).

I tested the resulting build with the Clojure REPL, works fine.
Comment 6 Jan Beich freebsd_committer freebsd_triage 2019-05-09 02:16:11 UTC
Comment on attachment 203870 [details]
jdk-use-ports-clang.patch

devel/llvm* bypass native-xtools which makes cross-builds (via qemu-user-static) very slow. I'd prefer __attribute__((optnone)) limited to the affected function or -O1 limited to the affected file.

Besides, armv7 needs the workaround as well.
Comment 7 Mikael Urankar freebsd_committer freebsd_triage 2019-05-09 08:54:55 UTC
(In reply to Jan Beich from comment #6)
Only the jvm and a small part of the jdk needs a c++ compiler, qemu won't add much time to the build.
Comment 8 Kyle Evans freebsd_committer freebsd_triage 2019-11-11 19:59:25 UTC
Any chance we can come up with a reasonable workaround for this based on what's done? This did not get fixed for clang9.
Comment 9 Dimitry Andric freebsd_committer freebsd_triage 2019-11-14 21:29:13 UTC
(In reply to Kyle Evans from comment #8)
I've found that upstream's https://reviews.llvm.org/rL370114 appears to fix this, but I'm waiting for a little while for confirmation from the author.
Comment 10 commit-hook freebsd_committer freebsd_triage 2019-11-15 06:57:15 UTC
A commit references this bug:

Author: dim
Date: Fri Nov 15 06:56:25 UTC 2019
New revision: 354724
URL: https://svnweb.freebsd.org/changeset/base/354724

Log:
  Merge commit 5bbb604bb from llvm git (by Craig Topper):

    [InstCombine] Disable some portions of foldGEPICmp for GEPs that
    return a vector of pointers. Fix other portions.

    llvm-svn: 370114

  This should fix instances of 'Assertion failed: (isa<X>(Val) &&
  "cast<Ty>() argument of incompatible type!"), function cast, file
  /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when
  building openjdk8 for aarch64 and armv7.

  Reported by:	jbeich
  PR:		236566
  MFC after:	3 days

Changes:
  head/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Comment 11 commit-hook freebsd_committer freebsd_triage 2019-11-18 07:05:53 UTC
A commit references this bug:

Author: dim
Date: Mon Nov 18 07:04:59 UTC 2019
New revision: 354803
URL: https://svnweb.freebsd.org/changeset/base/354803

Log:
  MFC r354724:

  Merge commit 5bbb604bb from llvm git (by Craig Topper):

    [InstCombine] Disable some portions of foldGEPICmp for GEPs that
    return a vector of pointers. Fix other portions.

    llvm-svn: 370114

  This should fix instances of 'Assertion failed: (isa<X>(Val) &&
  "cast<Ty>() argument of incompatible type!"), function cast, file
  /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when
  building openjdk8 for aarch64 and armv7.

  Reported by:	jbeich
  PR:		236566

Changes:
_U  stable/11/
  stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
_U  stable/12/
  stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Comment 12 Kubilay Kocak freebsd_committer freebsd_triage 2019-11-25 01:21:31 UTC
^Triage: Re-classify (base), track merges, assign to committer that resolved