All the jdks have a -Wuninitialized-const-pointer error due to passing
the uninitialized pict_attr to XRenderCreatePicture() for which this is
a const argument. This should be harmless because the valuemask is 0, so
none of the attributes are read in _XRenderProcessPictureAttributes().
Initializing the attributes to 0 doesn't change that but makes the
compiler happy.

On top of that jdk/25 has -Wnontrivial-memcall errors, with an annotation
that suggests an explicit cast to void *, which probably just papers over
the actual problem...

https://github.com/llvm/llvm-project/pull/111434
https://gcc.gnu.org/legacy-ml/gcc-patches/2017-04/msg01571.html

* For target hotspot_variant-server_libjvm_objs_resolvedFieldEntry.o:
/usr/obj/ports/jdk-25.0.3.6.1/jdk25u-jdk-25.0.3-6-1/src/hotspot/share/oops/resolvedFieldEntry.cpp:49:10:
 error: first argument in call to 'memset' is a pointer to non-trivially 
copyable type 'ResolvedFieldEntry' [-Werror,-Wnontrivial-memcall]
   49 |   memset(this, 0, sizeof(*this));
      |          ^
/usr/obj/ports/jdk-25.0.3.6.1/jdk25u-jdk-25.0.3-6-1/src/hotspot/share/oops/resolvedFieldEntry.cpp:49:10:
 note: explicitly cast the pointer to silence this warning
   49 |   memset(this, 0, sizeof(*this));
      |          ^
      |          (void*)

Index: 11/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/11/Makefile,v
diff -u -p -r1.70 Makefile
--- 11/Makefile 13 May 2026 11:43:13 -0000      1.70
+++ 11/Makefile 20 May 2026 05:53:13 -0000
@@ -13,6 +13,8 @@ PKGNAME=      jdk-${PACKAGE_VER}
 PKGSTEM=       jdk-11
 EPOCH=         0
 
+REVISION=      0
+
 DIST_SUBDIR=   jdk
 DISTNAME=      jdk-${VERSION_STR}
 WRKDIST=       ${WRKDIR}/jdk11u-jdk-${BASE_VER}-${BUILD_VER}-${BSD_PORT_REL}
Index: 
11/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
===================================================================
RCS file: 
11/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
diff -N 
11/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
11/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
      20 May 2026 05:51:39 -0000
@@ -0,0 +1,14 @@
+error: variable 'pict_attr' is uninitialized when passed as a const pointer 
argument here [-Werror,-Wuninitialized-const-pointer]
+
+Index: src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+--- src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c.orig
++++ src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+@@ -398,7 +398,7 @@ Java_sun_java2d_xr_XRBackendNative_createPixmap(JNIEnv
+ JNIEXPORT jint JNICALL
+ Java_sun_java2d_xr_XRBackendNative_createPictureNative
+  (JNIEnv *env, jclass cls, jint drawable, jlong formatPtr) {
+-  XRenderPictureAttributes pict_attr;
++  XRenderPictureAttributes pict_attr = { 0 };
+   return XRenderCreatePicture(awt_display, (Drawable) drawable,
+                               (XRenderPictFormat *) jlong_to_ptr(formatPtr),
+                                0, &pict_attr);
Index: 17/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/17/Makefile,v
diff -u -p -r1.41 Makefile
--- 17/Makefile 13 May 2026 17:51:09 -0000      1.41
+++ 17/Makefile 20 May 2026 05:53:19 -0000
@@ -13,6 +13,8 @@ PKGNAME=      jdk-${PACKAGE_VER}
 PKGSTEM=       jdk-17
 EPOCH=         0
 
+REVISION=      0
+
 DIST_SUBDIR=   jdk
 DISTNAME=      jdk-${VERSION_STR}
 WRKDIST=       ${WRKDIR}/jdk17u-jdk-${BASE_VER}-${BUILD_VER}-${BSD_PORT_REL}
Index: 
17/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
===================================================================
RCS file: 
17/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
diff -N 
17/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
17/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
      20 May 2026 05:51:39 -0000
@@ -0,0 +1,14 @@
+error: variable 'pict_attr' is uninitialized when passed as a const pointer 
argument here [-Werror,-Wuninitialized-const-pointer]
+
+Index: src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+--- src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c.orig
++++ src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+@@ -339,7 +339,7 @@ Java_sun_java2d_xr_XRBackendNative_createPixmap(JNIEnv
+ JNIEXPORT jint JNICALL
+ Java_sun_java2d_xr_XRBackendNative_createPictureNative
+  (JNIEnv *env, jclass cls, jint drawable, jlong formatPtr) {
+-  XRenderPictureAttributes pict_attr;
++  XRenderPictureAttributes pict_attr = { 0 };
+   return XRenderCreatePicture(awt_display, (Drawable) drawable,
+                               (XRenderPictFormat *) jlong_to_ptr(formatPtr),
+                                0, &pict_attr);
Index: 21/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/21/Makefile,v
diff -u -p -r1.16 Makefile
--- 21/Makefile 13 May 2026 17:52:30 -0000      1.16
+++ 21/Makefile 20 May 2026 05:53:22 -0000
@@ -13,6 +13,8 @@ PKGNAME=      jdk-${PACKAGE_VER}
 PKGSTEM=       jdk-21
 EPOCH=         0
 
+REVISION=      0
+
 DIST_SUBDIR=   jdk
 DISTNAME=      jdk-${VERSION_STR}
 WRKDIST=       ${WRKDIR}/jdk21u-jdk-${BASE_VER}-${BUILD_VER}-${BSD_PORT_REL}
Index: 
21/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
===================================================================
RCS file: 
21/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
diff -N 
21/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
21/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
      20 May 2026 05:51:39 -0000
@@ -0,0 +1,14 @@
+error: variable 'pict_attr' is uninitialized when passed as a const pointer 
argument here [-Werror,-Wuninitialized-const-pointer]
+
+Index: src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+--- src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c.orig
++++ src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+@@ -339,7 +339,7 @@ Java_sun_java2d_xr_XRBackendNative_createPixmap(JNIEnv
+ JNIEXPORT jint JNICALL
+ Java_sun_java2d_xr_XRBackendNative_createPictureNative
+  (JNIEnv *env, jclass cls, jint drawable, jlong formatPtr) {
+-  XRenderPictureAttributes pict_attr;
++  XRenderPictureAttributes pict_attr = { 0 };
+   return XRenderCreatePicture(awt_display, (Drawable) drawable,
+                               (XRenderPictFormat *) jlong_to_ptr(formatPtr),
+                                0, &pict_attr);
Index: 25/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/25/Makefile,v
diff -u -p -r1.9 Makefile
--- 25/Makefile 13 May 2026 14:32:05 -0000      1.9
+++ 25/Makefile 20 May 2026 05:53:28 -0000
@@ -13,6 +13,8 @@ PKGNAME=      jdk-${PACKAGE_VER}
 PKGSTEM=       jdk-25
 EPOCH=         0
 
+REVISION=      0
+
 DIST_SUBDIR=   jdk
 DISTNAME=      jdk-${VERSION_STR}
 WRKDIST=       ${WRKDIR}/jdk25u-jdk-${BASE_VER}-${BUILD_VER}-${BSD_PORT_REL}
Index: 25/patches/patch-src_hotspot_share_oops_resolvedFieldEntry_cpp
===================================================================
RCS file: 25/patches/patch-src_hotspot_share_oops_resolvedFieldEntry_cpp
diff -N 25/patches/patch-src_hotspot_share_oops_resolvedFieldEntry_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 25/patches/patch-src_hotspot_share_oops_resolvedFieldEntry_cpp      20 May 
2026 05:51:39 -0000
@@ -0,0 +1,14 @@
+error: first argument in call to 'memset' is a pointer to non-trivially 
copyable type 'ResolvedFieldEntry' [-Werror,-Wnontrivial-memcall]
+
+Index: src/hotspot/share/oops/resolvedFieldEntry.cpp
+--- src/hotspot/share/oops/resolvedFieldEntry.cpp.orig
++++ src/hotspot/share/oops/resolvedFieldEntry.cpp
+@@ -46,7 +46,7 @@ void ResolvedFieldEntry::print_on(outputStream* st) co
+ #if INCLUDE_CDS
+ void ResolvedFieldEntry::remove_unshareable_info() {
+   u2 saved_cpool_index = _cpool_index;
+-  memset(this, 0, sizeof(*this));
++  memset((void *)this, 0, sizeof(*this));
+   _cpool_index = saved_cpool_index;
+ }
+ 
Index: 25/patches/patch-src_hotspot_share_oops_resolvedMethodEntry_cpp
===================================================================
RCS file: 25/patches/patch-src_hotspot_share_oops_resolvedMethodEntry_cpp
diff -N 25/patches/patch-src_hotspot_share_oops_resolvedMethodEntry_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 25/patches/patch-src_hotspot_share_oops_resolvedMethodEntry_cpp     20 May 
2026 05:51:39 -0000
@@ -0,0 +1,20 @@
+error: first argument in call to 'memset' is a pointer to non-trivially 
copyable type 'ResolvedMethodEntry' [-Werror,-Wnontrivial-memcall]
+
+Index: src/hotspot/share/oops/resolvedMethodEntry.cpp
+--- src/hotspot/share/oops/resolvedMethodEntry.cpp.orig
++++ src/hotspot/share/oops/resolvedMethodEntry.cpp
+@@ -40,12 +40,12 @@ void ResolvedMethodEntry::reset_entry() {
+   if (has_resolved_references_index()) {
+     u2 saved_resolved_references_index = 
_entry_specific._resolved_references_index;
+     u2 saved_cpool_index = _cpool_index;
+-    memset(this, 0, sizeof(*this));
++    memset((void *)this, 0, sizeof(*this));
+     set_resolved_references_index(saved_resolved_references_index);
+     _cpool_index = saved_cpool_index;
+   } else {
+     u2 saved_cpool_index = _cpool_index;
+-    memset(this, 0, sizeof(*this));
++    memset((void *)this, 0, sizeof(*this));
+     _cpool_index = saved_cpool_index;
+   }
+ }
Index: 
25/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
===================================================================
RCS file: 
25/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
diff -N 
25/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
25/patches/patch-src_java_desktop_unix_native_libawt_xawt_java2d_x11_XRBackendNative_c
      20 May 2026 05:51:39 -0000
@@ -0,0 +1,14 @@
+error: variable 'pict_attr' is uninitialized when passed as a const pointer 
argument here [-Werror,-Wuninitialized-const-pointer]
+
+Index: src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+--- src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c.orig
++++ src/java.desktop/unix/native/libawt_xawt/java2d/x11/XRBackendNative.c
+@@ -339,7 +339,7 @@ Java_sun_java2d_xr_XRBackendNative_createPixmap(JNIEnv
+ JNIEXPORT jint JNICALL
+ Java_sun_java2d_xr_XRBackendNative_createPictureNative
+  (JNIEnv *env, jclass cls, jint drawable, jlong formatPtr) {
+-  XRenderPictureAttributes pict_attr;
++  XRenderPictureAttributes pict_attr = { 0 };
+   return XRenderCreatePicture(awt_display, (Drawable) drawable,
+                               (XRenderPictFormat *) jlong_to_ptr(formatPtr),
+                                0, &pict_attr);

Reply via email to