Bug 255904

Summary: java/openjdk15: Fix compile error (and possible segfaults) with clang 12
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-java (Nobody) <java>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (java)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 255570    
Attachments:
Description Flags
Fix java/openjdk15 build with clang 12 none

Description Dimitry Andric freebsd_committer freebsd_triage 2021-05-15 15:39:10 UTC
Created attachment 224971 [details]
Fix java/openjdk15 build with clang 12

During an exp-run for llvm 12 (see bug 255570), it turned out that at least openjdk11 and openjdk12 do not build with clang 12.0.0. The exp-run therefore skipped openjdk15.

Building this manually shows that it results in a compile error:

gmake[4]: Leaving directory '/wrkdirs/share/dim/ports/java/openjdk15/work/jdk15u-jdk-15.0.2-7-1/make'
/wrkdirs/share/dim/ports/java/openjdk15/work/jdk15u-jdk-15.0.2-7-1/src/hotspot/cpu/x86/vm_version_ext_x86.cpp:748:3: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
  "",
  ^
/wrkdirs/share/dim/ports/java/openjdk15/work/jdk15u-jdk-15.0.2-7-1/src/hotspot/cpu/x86/vm_version_ext_x86.cpp:747:3: note: place parentheses around the string literal to silence warning
  "Opteron QC/Phenom"  // Barcelona et.al.
  ^
1 error generated.

This is due to a missing backport of this commit [1]:

commit f8a9602a0a65cdc98eb940aac9529256ded2bf42
Author: Yasumasa Suenaga <ysuenaga@openjdk.org>
Date:   Thu Jan 21 06:08:13 2021 +0000

    8260025: Missing comma in VM_Version_Ext::_family_id_amd

    Reviewed-by: dholmes, stuefe

Even after applying this fix, there is still a possibility of a segfault during the build, due to another missing backport, of this commit [2]:

commit c484d8904285652246c3af212a4211b9a8955149
Author: Thomas Stuefe <stuefe@openjdk.org>
Date:   Tue Mar 16 05:49:01 2021 +0000

    8263557: Possible NULL dereference in Arena::destruct_contents()

    Reviewed-by: kbarrett, coleenp

I have attached a patch that adds these commits as additional patches.

[1] https://github.com/openjdk/jdk/commit/f8a9602a0a65cdc98eb940aac9529256ded2bf42
[2] https://github.com/openjdk/jdk/commit/c484d8904285652246c3af212a4211b9a8955149
Comment 1 commit-hook freebsd_committer freebsd_triage 2021-05-29 14:09:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=668230eee6bbff5f8b7cfbd95f21b2a6b16ae188

commit 668230eee6bbff5f8b7cfbd95f21b2a6b16ae188
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-05-15 15:36:21 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-05-29 14:08:19 +0000

    java/openjdk15: fix build with clang 12

    During an exp-run for llvm 12 (see bug 255570), it turned out that at
    least openjdk11 and openjdk12 do not build with clang 12.0.0. The
    exp-run therefore skipped openjdk15.

    Building this manually shows that it results in a compile error:

    gmake[4]: Leaving directory '/wrkdirs/usr/ports/java/openjdk15/work/jdk15u-jdk-15.0.2-7-1/make'
    /wrkdirs/usr/ports/java/openjdk15/work/jdk15u-jdk-15.0.2-7-1/src/hotspot/cpu/x86/vm_version_ext_x86.cpp:748:3: error: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Werror,-Wstring-concatenation]
      "",
      ^
    /wrkdirs/usr/ports/java/openjdk15/work/jdk15u-jdk-15.0.2-7-1/src/hotspot/cpu/x86/vm_version_ext_x86.cpp:747:3: note: place parentheses around the string literal to silence warning
      "Opteron QC/Phenom"  // Barcelona et.al.
      ^
    1 error generated.

    This is due to a missing backport of this upstream commit:

    commit f8a9602a0a65cdc98eb940aac9529256ded2bf42
    Author: Yasumasa Suenaga <ysuenaga@openjdk.org>
    Date:   Thu Jan 21 06:08:13 2021 +0000

        8260025: Missing comma in VM_Version_Ext::_family_id_amd

        Reviewed-by: dholmes, stuefe

    Even after applying this fix, there is still a possibility of a segfault
    during the build, due to another missing backport, of this upstream
    commit:

    commit c484d8904285652246c3af212a4211b9a8955149
    Author: Thomas Stuefe <stuefe@openjdk.org>
    Date:   Tue Mar 16 05:49:01 2021 +0000

        8263557: Possible NULL dereference in Arena::destruct_contents()

        Reviewed-by: kbarrett, coleenp

    Approved by:    maintainer timeout (2 weeks)
    PR:             255904
    MFH:            2021Q2

 .../openjdk15/files/patch-commit-c484d890428 (new) | 23 ++++++++++++++++++
 .../openjdk15/files/patch-commit-f8a9602a0a6 (new) | 28 ++++++++++++++++++++++
 2 files changed, 51 insertions(+)