--- jdk10/make/hotspot/lib/CompileJvm.gmk	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/make/hotspot/lib/CompileJvm.gmk	2018-01-26 08:12:27.089447548 +0100
@@ -206,6 +206,11 @@
 # default.
 JVM_STRIPFLAGS ?= $(STRIPFLAGS)
 
+JVM_CXXFLAGS := $(JVM_CFLAGS)
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+  JVM_CXXFLAGS += -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse
+endif
+
 ################################################################################
 # Now set up the actual compilation of the main hotspot native library
 
@@ -221,6 +226,7 @@
     CFLAGS := $(JVM_CFLAGS), \
     CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
     CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
+    CXXFLAGS := $(JVM_CXXFLAGS), \
     vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
     arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
     DISABLED_WARNINGS_clang := tautological-compare, \
--- jdk10/make/lib/Awt2dLibraries.gmk	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/make/lib/Awt2dLibraries.gmk	2018-01-26 08:12:27.097447548 +0100
@@ -394,6 +394,11 @@
 # The fast floor code loses precision.
 LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
 
+# Avoid warning for GCC 6
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+  LCMS_CFLAGS += -Wno-misleading-indentation
+endif
+
 ifeq ($(USE_EXTERNAL_LCMS), true)
   # If we're using an external library, we'll just need the wrapper part.
   # By including it explicitly, all other files will be excluded.
--- jdk10/src/hotspot/cpu/x86/assembler_x86.cpp	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/src/hotspot/cpu/x86/assembler_x86.cpp	2018-01-26 08:12:27.089447548 +0100
@@ -188,10 +188,9 @@
 // Address.  An index of 4 (rsp) corresponds to having no index, so convert
 // that to noreg for the Address constructor.
 Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {
-  RelocationHolder rspec;
-  if (disp_reloc != relocInfo::none) {
-    rspec = Relocation::spec_simple(disp_reloc);
-  }
+  RelocationHolder rspec = (disp_reloc == relocInfo::none)
+                                  ? RelocationHolder::none
+                                  : rspec = Relocation::spec_simple(disp_reloc);
   bool valid_index = index != rsp->encoding();
   if (valid_index) {
     Address madr(as_Register(base), as_Register(index), (Address::ScaleFactor)scale, in_ByteSize(disp));
--- jdk10/src/hotspot/share/c1/c1_Instruction.hpp	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/src/hotspot/share/c1/c1_Instruction.hpp	2018-01-26 08:12:27.093447548 +0100
@@ -348,9 +348,7 @@
  public:
   void* operator new(size_t size) throw() {
     Compilation* c = Compilation::current();
-    void* res = c->arena()->Amalloc(size);
-    ((Instruction*)res)->_id = c->get_next_id();
-    return res;
+    return c->arena()->Amalloc(size);
   }
 
   static const int no_bci = -99;
@@ -427,6 +425,7 @@
     check_state(state_before);
     assert(type != NULL && (!type->is_constant() || type_is_constant), "type must exist");
     update_exception_state(_state_before);
+    _id = Compilation::current()->get_next_id();
   }
 
   // accessors
@@ -1692,6 +1691,9 @@
 #ifndef PRODUCT
     set_printable_bci(bci);
 #endif
+    Compilation* c = Compilation::current();
+    _id = c->get_next_id();
+    _block_id = c->get_next_block_id();
   }
 
   // accessors
--- jdk10/src/hotspot/share/code/relocInfo.hpp	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/src/hotspot/share/code/relocInfo.hpp	2018-01-26 08:12:27.093447548 +0100
@@ -832,7 +832,7 @@
 }
 
 
-inline RelocationHolder::RelocationHolder(Relocation* r) {
+inline RelocationHolder::RelocationHolder(Relocation* r) : _relocbuf() {
   // wordwise copy from r (ok if it copies garbage after r)
   for (int i = 0; i < _relocbuf_size; i++) {
     _relocbuf[i] = ((void**)r)[i];
--- jdk10/src/hotspot/share/opto/type.cpp	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/src/hotspot/share/opto/type.cpp	2018-01-26 08:12:27.093447548 +0100
@@ -50,7 +50,7 @@
 
 // Array which maps compiler types to Basic Types
 const Type::TypeInfo Type::_type_info[Type::lastype] = {
-  { Bad,             T_ILLEGAL,    "bad",           false, Node::NotAMachineReg, relocInfo::none          },  // Bad
+  { Bad,             T_ILLEGAL,    "bad",           false, (int)Node::NotAMachineReg, relocInfo::none          },  // Bad
   { Control,         T_ILLEGAL,    "control",       false, 0,                    relocInfo::none          },  // Control
   { Bottom,          T_VOID,       "top",           false, 0,                    relocInfo::none          },  // Top
   { Bad,             T_INT,        "int:",          false, Op_RegI,              relocInfo::none          },  // Int
@@ -58,8 +58,8 @@
   { Half,            T_VOID,       "half",          false, 0,                    relocInfo::none          },  // Half
   { Bad,             T_NARROWOOP,  "narrowoop:",    false, Op_RegN,              relocInfo::none          },  // NarrowOop
   { Bad,             T_NARROWKLASS,"narrowklass:",  false, Op_RegN,              relocInfo::none          },  // NarrowKlass
-  { Bad,             T_ILLEGAL,    "tuple:",        false, Node::NotAMachineReg, relocInfo::none          },  // Tuple
-  { Bad,             T_ARRAY,      "array:",        false, Node::NotAMachineReg, relocInfo::none          },  // Array
+  { Bad,             T_ILLEGAL,    "tuple:",        false, (int)Node::NotAMachineReg, relocInfo::none          },  // Tuple
+  { Bad,             T_ARRAY,      "array:",        false, (int)Node::NotAMachineReg, relocInfo::none          },  // Array
 
 #ifdef SPARC
   { Bad,             T_ILLEGAL,    "vectors:",      false, 0,                    relocInfo::none          },  // VectorS
--- jdk10/src/java.base/share/native/libfdlibm/e_asin.c	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/src/java.base/share/native/libfdlibm/e_asin.c	2018-01-26 08:12:27.097447548 +0100
@@ -97,8 +97,9 @@
         } else if (ix<0x3fe00000) {     /* |x|<0.5 */
             if(ix<0x3e400000) {         /* if |x| < 2**-27 */
                 if(huge+x>one) return x;/* return x with inexact if x!=0*/
-            } else
+            } else {
                 t = x*x;
+            }
                 p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5)))));
                 q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4)));
                 w = p/q;
--- jdk10/src/java.base/share/native/libfdlibm/k_rem_pio2.c	2018-01-23 13:23:55.000000000 +0100
+++ jdk10/src/java.base/share/native/libfdlibm/k_rem_pio2.c	2018-01-26 08:12:27.097447548 +0100
@@ -197,7 +197,9 @@
 
     /* compute q[0],q[1],...q[jk] */
         for (i=0;i<=jk;i++) {
-            for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw;
+            for (j=0,fw=0.0;j<=jx;j++) {
+                fw += x[j]*f[jx+i-j]; q[i] = fw;
+            }
         }
 
         jz = jk;
