Bug 216016 - java/openjdk7 and java/openjdk8: fails to build with clang 4.0
Summary: java/openjdk7 and java/openjdk8: fails to build with clang 4.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Greg Lewis
URL:
Keywords: needs-patch
Depends on:
Blocks: 216008
  Show dependency treegraph
 
Reported: 2017-01-13 09:01 UTC by Jan Beich
Modified: 2017-01-31 00:04 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (glewis)


Attachments
possible fix (5.15 KB, patch)
2017-01-13 20:31 UTC, Jan Beich
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 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