Bug 216016

Summary: java/openjdk7 and java/openjdk8: fails to build with clang 4.0
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: Greg Lewis <glewis>
Status: Closed FIXED    
Severity: Affects Only Me CC: dim, emaste
Priority: --- Keywords: needs-patch
Version: LatestFlags: bugzilla: maintainer-feedback? (glewis)
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215861
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216015
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216046
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216051
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216052
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216056
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216058
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216072
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216074
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216075
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216076
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216159
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216176
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216194
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216197
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216198
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216199
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216200
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216203
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216206
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216211
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216213
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216214
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216215
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216216
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216217
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216218
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216221
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216222
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216227
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216228
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216233
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216234
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216235
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216253
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216354
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216355
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216356
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216357
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216358
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216615
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216617
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216618
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216619
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216620
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216621
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216622
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216623
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216624
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216626
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216627
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216629
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216630
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216631
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216632
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216633
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216634
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216635
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216636
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216637
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216638
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216639
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216640
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216641
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216642
Bug Depends on:    
Bug Blocks: 216008    
Attachments:
Description Flags
possible fix none

Description Jan Beich freebsd_committer 2017-01-13 09:01:13 UTC
hotspot/src/share/vm/runtime/virtualspace.cpp:527:14: error: ordered comparison between pointer and zero ('char *' and 'int')
  if (base() > 0) {
      ~~~~~~ ^ ~
hotspot/src/share/vm/runtime/virtualspace.cpp:546:14: error: ordered comparison between pointer and zero ('char *' and 'int')
  if (base() > 0) {
      ~~~~~~ ^ ~

regressed by: https://github.com/llvm-mirror/clang/commit/4b6ad14285f3
Comment 1 Jan Beich freebsd_committer 2017-01-13 20:01:28 UTC
java/openjdk8 also has

hotspot/src/share/vm/opto/lcm.cpp:52:35: error: ordered comparison between pointer and zero ('address' (aka 'unsigned char *') and 'int')
  if (Universe::narrow_oop_base() > 0) { // Implies UseCompressedOops.
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
Comment 2 Jan Beich freebsd_committer 2017-01-13 20:31:51 UTC
Created attachment 178865 [details]
possible fix

Can you double-check or switch to upstream fix (if any)?
Comment 3 Dimitry Andric freebsd_committer 2017-01-13 22:15:05 UTC
I asked the implementer of that upstream change: 

>> There will probably be more of these.  Is it the intent of this change that
>> such software must now be patched up?
> 
> That is the intent; such code is not valid c++ any more per the latest defect
> resolutions (and is not valid C). Depending on the level of pain, we could
> allow these comparisons as an extension, so I would welcome your input here.
> However (for instance) the example above looks like a bug.

E.g. ordered comparisons between pointers and (integer) zero are invalid, and should be fixed.
Comment 4 Greg Lewis freebsd_committer 2017-01-15 19:42:40 UTC
Thanks Jan.  I'd love to upstream this fix, but to do so you'd need to sign the oracle contributor agreement.  Are you willing/able to do that?

http://openjdk.java.net/contribute/
Comment 5 commit-hook freebsd_committer 2017-01-15 22:51:24 UTC
A commit references this bug:

Author: glewis
Date: Sun Jan 15 22:50:38 UTC 2017
New revision: 431605
URL: https://svnweb.freebsd.org/changeset/ports/431605

Log:
  . Fix compilation with Clang 4.0

  PR:		216016
  Submitted by:	jbeich@

Changes:
  head/java/openjdk7/Makefile
  head/java/openjdk7/files/patch-hotspot_src_share_vm_runtime_virtualspace.cpp
Comment 6 commit-hook freebsd_committer 2017-01-15 22:52:29 UTC
A commit references this bug:

Author: glewis
Date: Sun Jan 15 22:51:52 UTC 2017
New revision: 431607
URL: https://svnweb.freebsd.org/changeset/ports/431607

Log:
  . Fix compilation with Clang 4.0

  PR:		216016
  Submitted by:	jbeich@

Changes:
  head/java/openjdk8/Makefile
  head/java/openjdk8/files/patch-hotspot_src_share_vm_opto_lcm.cpp
  head/java/openjdk8/files/patch-hotspot_src_share_vm_runtime_virtualspace.cpp
Comment 7 Jan Beich freebsd_committer 2017-01-16 05:11:20 UTC
(In reply to Greg Lewis from comment #4)
> I'd love to upstream this fix, but to do so you'd need to sign the
> oracle contributor agreement.  Are you willing/able to do that?

No. CLAs don't respect privacy and try to bind individuals rather than code. OCA isn't any better. So, I'm putting my change here into public domain instead. Upstream is likely to come up with a similar fix as part of building for new Android or OS X releases, anyway.
Comment 8 Ed Maste freebsd_committer 2017-01-16 17:24:58 UTC
> need to sign the oracle contributor agreement

Do they have an exception for very small changes like this? The FSF goes even further and requires copyright assignment, but they've accepted similar changes from me for binutils w/o it.
Comment 9 Greg Lewis freebsd_committer 2017-01-18 05:38:10 UTC
That's a good question.  I'll have to see if I can find out.
Comment 10 commit-hook freebsd_committer 2017-01-19 05:30:52 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jan 19 05:30:36 UTC 2017
New revision: 431848
URL: https://svnweb.freebsd.org/changeset/ports/431848

Log:
  MFH: r431605 by glewis

  . Fix compilation with Clang 4.0

  PR:		216016
  Submitted by:	jbeich@
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q1/
  branches/2017Q1/java/openjdk7/Makefile
  branches/2017Q1/java/openjdk7/files/patch-hotspot_src_share_vm_runtime_virtualspace.cpp
Comment 11 commit-hook freebsd_committer 2017-01-19 05:33:56 UTC
A commit references this bug:

Author: jbeich
Date: Thu Jan 19 05:33:20 UTC 2017
New revision: 431849
URL: https://svnweb.freebsd.org/changeset/ports/431849

Log:
  MFH: r431607 by glewis

  . Fix compilation with Clang 4.0

  PR:		216016
  Submitted by:	jbeich@
  Approved by:	ports-secteam blanket

Changes:
_U  branches/2017Q1/
  branches/2017Q1/java/openjdk8/Makefile
  branches/2017Q1/java/openjdk8/files/patch-hotspot_src_share_vm_opto_lcm.cpp
  branches/2017Q1/java/openjdk8/files/patch-hotspot_src_share_vm_runtime_virtualspace.cpp