<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Thanks. harfbuzz is now fixed upstream. libjpeg has acknowledged
      the patch for shift-negative-value warnings.</p>
    <p>Can someone advise on the minor fix in libdt_socket component ?<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 02/03/2018 05:47 AM, Philip Race
      wrote:<br>
    </div>
    <blockquote cite="mid:5A75BD5F.5080309@oracle.com" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      jpeg + harfbuzz are imported libraries. There's no point in a
      source fix in JDK'scopy as<br>
      it will get overwritten when we upgrade. No way we are tracking
      such patches to reapply them.<br>
      <br>
      If warnings there are an issue either update the makefiles or use
      disable-warnings-as-errors<br>
      ... and perhaps report the issue upstream ..<br>
      <br>
      -phil.<br>
      <br>
      On 2/3/18, 1:35 AM, Alan Bateman wrote:
      <blockquote
        cite="mid:4c5248f3-e78d-31ba-c892-fd7df1d027af@oracle.com"
        type="cite">
        <meta http-equiv="content-type" content="text/html;
          charset=utf-8">
        <br>
        This was sent to core-libs-dev, I assume it was meant for 2d-dev
        and serviceability-dev.<br>
        <div class="moz-forward-container"><br>
          -------- Forwarded Message --------
          <table class="moz-email-headers-table" border="0"
            cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
                </th>
                <td>[PATCH] Fix compiler warnings with newer GCC 7.2.1</td>
              </tr>
              <tr>
                <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date:
                </th>
                <td>Fri, 2 Feb 2018 16:12:08 -0800</td>
              </tr>
              <tr>
                <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From:
                </th>
                <td>Indu Bhagat <a moz-do-not-send="true"
                    class="moz-txt-link-rfc2396E"
                    href="mailto:indu.bhagat@oracle.com"><indu.bhagat@oracle.com></a></td>
              </tr>
              <tr>
                <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To:
                </th>
                <td><a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:core-libs-dev@openjdk.java.net">core-libs-dev@openjdk.java.net</a></td>
              </tr>
            </tbody>
          </table>
          <br>
          <br>
          <pre>This patch fixes a few of the compiler warnings when using gcc 7.2.1.

In general there are many other warnings (a majority of which are implicit fallthrough warnings in jdk.crypto.ec package's ecp_*.c files and java.desktop package's splashscreen_gfx_impl.h file).
I can post them if there is interest.
Most warnings, however, look benign (modulo some warnings about unintialized access that I cannot comment on; they need that the code be thoroughly understood).
libfdlibm misleading indentation warnings are already knownhttp://mail.openjdk.java.net/pipermail/jdk9-dev/2016-June/004494.html

Thanks

----------------------------------------------
The patch fixes the following warnings :

1. <jdk-dev>/jdk/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c: In function ‘mask_s2u’:
   <jdk-dev>/jdk/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c:389:22: warning: left shift of negative value [-Wshift-negative-value]
     *mask = htonl(-1 << (32 - m));
                      ^
2. <jdk-dev>/jdk/src/java.desktop/share/native/libjavajpeg/jdphuff.c: In function ‘decode_mcu_AC_refine’:
   <jdk-dev>/jdk/src/java.desktop/share/native/libjavajpeg/jdphuff.c:505:17: warning: left shift of negative value [-Wshift-negative-value]
   int m1 = (-1) << cinfo->Al;   /* -1 in the bit position being coded*/
                 ^~
3. <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc: In function ‘void position_mark(const hb_ot_shape_plan_t*, hb_font_t*, hb_buffer_t*, hb_glyph_extents_t&, unsigned int, unsigned int)’:
   <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:223:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
       } else if (buffer->props.direction == HB_DIRECTION_RTL) {
              ^~
   <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:229:5: note: here
     default:
     ^~~~~~~
   <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:261:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
       base_extents.height -= y_gap;
       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
   <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:264:5: note: here
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
     ^~~~
   <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:282:27: warning: this statement may fall through [-Wimplicit-fallthrough=]
       base_extents.height -= y_gap;
       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
   <jdk-dev>/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:285:5: note: here
     case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
     ^~~~
-----------

diff --git a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh
--- a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh
+++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh
@@ -158,6 +158,9 @@
     */
 #  include <sal.h>
 #  define HB_FALLTHROUGH __fallthrough
+#elif __GNUC__ >= 7
+   /* GNU fallthrough attribute is available from GCC7 */
+#  define HB_FALLTHROUGH __attribute__((fallthrough))
 #else
 #  define HB_FALLTHROUGH /* FALLTHROUGH */
 #endif
diff --git a/src/java.desktop/share/native/libjavajpeg/jdphuff.c b/src/java.desktop/share/native/libjavajpeg/jdphuff.c
--- a/src/java.desktop/share/native/libjavajpeg/jdphuff.c
+++ b/src/java.desktop/share/native/libjavajpeg/jdphuff.c
@@ -501,8 +501,10 @@
 {
   phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
   int Se = cinfo->Se;
-  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
-  int m1 = (-1) << cinfo->Al;   /* -1 in the bit position being coded */
+  /* 1 in the bit position being coded */
+  int p1 = 1 << cinfo->Al;
+  /* -1 in the bit position being coded */
+  int m1 = (int)((unsigned)(~0) << cinfo->Al);
   register int s, k, r;
   unsigned int EOBRUN;
   JBLOCKROW block;
diff --git a/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c b/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c
--- a/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c
+++ b/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c
@@ -386,7 +386,7 @@
        return instr;
     }
 
-    *mask = htonl(-1 << (32 - m));
+    *mask = htonl((uint32_t)(~0) << (32 - m));
     return s;
 }
 

</pre>
        </div>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>