From andrew_m_leonard at uk.ibm.com Tue Aug 21 13:04:50 2018 From: andrew_m_leonard at uk.ibm.com (Andrew Leonard) Date: Tue, 21 Aug 2018 14:04:50 +0100 Subject: RFR JDK-8209786: gcc 7.3 compiler errors Message-ID: Hi, We have discovered issues with gcc 7.3 on zLinux, combined with OpenJDK's default compiler options has highlighted a couple of native code issues, with: - validating loop test array bounds - left shifts of negative values I have created bug https://bugs.openjdk.java.net/browse/JDK-8209786 and attached the webrev fix here: http://cr.openjdk.java.net/~aleonard/gcc73/webrev.00/ I'd like to request a sponsor for this fix please? Many thanks Andrew Andrew Leonard Java Runtimes Development IBM Hursley IBM United Kingdom Ltd Phone internal: 245913, external: 01962 815913 internet email: andrew_m_leonard at uk.ibm.com Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From goetz.lindenmaier at sap.com Wed Aug 22 07:18:51 2018 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Wed, 22 Aug 2018 07:18:51 +0000 Subject: RFR JDK-8209786: gcc 7.3 compiler errors In-Reply-To: References: Message-ID: <7ab8196fb4ae4578a27a665eff7edbc7@sap.com> Hi Andrew, please post this RFR to core-libs-dev. s390x-prot-dev is only for questions about the port etc. It is not for reviews that go to jdk/jdk. Also, I'm not sure that your change in java.desktop is correct. You now negate after shifting. - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + mlib_u64 emask = (mlib_u64)-(((mlib_s64)1) >> ((8 - (size - i)) * 8)); before, -1 >> 3 will result in something like 000111...111 now -(1>>3) will result in 000....0000 Best regards, Goetz. > -----Original Message----- > From: s390x-port-dev On > Behalf Of Andrew Leonard > Sent: Dienstag, 21. August 2018 15:05 > To: s390x-port-dev at openjdk.java.net > Subject: RFR JDK-8209786: gcc 7.3 compiler errors > > Hi, > We have discovered issues with gcc 7.3 on zLinux, combined with OpenJDK's > default compiler options has highlighted a couple of native code issues, > with: > - validating loop test array bounds > - left shifts of negative values > I have created bug https://bugs.openjdk.java.net/browse/JDK-8209786 > and attached the webrev fix here: > http://cr.openjdk.java.net/~aleonard/gcc73/webrev.00/ > > I'd like to request a sponsor for this fix please? > > Many thanks > Andrew > > Andrew Leonard > Java Runtimes Development > IBM Hursley > IBM United Kingdom Ltd > Phone internal: 245913, external: 01962 815913 > internet email: andrew_m_leonard at uk.ibm.com > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 > 3AU From lutz.schmidt at sap.com Wed Aug 22 15:50:05 2018 From: lutz.schmidt at sap.com (Schmidt, Lutz) Date: Wed, 22 Aug 2018 15:50:05 +0000 Subject: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors Message-ID: <3A00F18A-CC4D-4DCA-A7D8-18F5DB003B45@sap.com> Hi Andrew, just recently I was confronted with a similar "shift issue" which prompted me to read the language standard (again). I have summarized my understanding in a little text file which you may find attached. Have fun reading! Best Regards, Lutz ?On 22.08.18, 09:18, "s390x-port-dev on behalf of Lindenmaier, Goetz" wrote: Hi Andrew, please post this RFR to core-libs-dev. s390x-prot-dev is only for questions about the port etc. It is not for reviews that go to jdk/jdk. Also, I'm not sure that your change in java.desktop is correct. You now negate after shifting. - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + mlib_u64 emask = (mlib_u64)-(((mlib_s64)1) >> ((8 - (size - i)) * 8)); before, -1 >> 3 will result in something like 000111...111 now -(1>>3) will result in 000....0000 Best regards, Goetz. > -----Original Message----- > From: s390x-port-dev On > Behalf Of Andrew Leonard > Sent: Dienstag, 21. August 2018 15:05 > To: s390x-port-dev at openjdk.java.net > Subject: RFR JDK-8209786: gcc 7.3 compiler errors > > Hi, > We have discovered issues with gcc 7.3 on zLinux, combined with OpenJDK's > default compiler options has highlighted a couple of native code issues, > with: > - validating loop test array bounds > - left shifts of negative values > I have created bug https://bugs.openjdk.java.net/browse/JDK-8209786 > and attached the webrev fix here: > http://cr.openjdk.java.net/~aleonard/gcc73/webrev.00/ > > I'd like to request a sponsor for this fix please? > > Many thanks > Andrew > > Andrew Leonard > Java Runtimes Development > IBM Hursley > IBM United Kingdom Ltd > Phone internal: 245913, external: 01962 815913 > internet email: andrew_m_leonard at uk.ibm.com > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 > 3AU -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: cppShiftOperations.txt URL: From andrew_m_leonard at uk.ibm.com Thu Aug 23 08:05:36 2018 From: andrew_m_leonard at uk.ibm.com (Andrew Leonard) Date: Thu, 23 Aug 2018 09:05:36 +0100 Subject: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors In-Reply-To: <3A00F18A-CC4D-4DCA-A7D8-18F5DB003B45@sap.com> References: <3A00F18A-CC4D-4DCA-A7D8-18F5DB003B45@sap.com> Message-ID: Thanks for the reviews guys, Lutz, yes, those "undefined" behaviour's is what gcc7.3 is now highlighting, and we're trying to fix. Goetz, I see what you're saying, I think we should leave the right shifts alone then, although as stated in Lutz's doc reference they are implementation-defined, I think the original code is trying to achieve the former 000111...111, I doubt it was trying to achieve 0! before, -1 >> 3 will result in something like 000111...111 now -(1>>3) will result in 000....0000 It is the left shirt of -ve values that is the real concern. Joe, also suggested we should tackle this by changing the compiler options rather than changing libfdlibm, which maybe the alternative as this source has not changed for a long time and maybe best to let working code remain unchanged, i'd have to investigate a compiler option fix... Keith, do you have any other views? Thanks Andrew Andrew Leonard Java Runtimes Development IBM Hursley IBM United Kingdom Ltd Phone internal: 245913, external: 01962 815913 internet email: andrew_m_leonard at uk.ibm.com From: "Schmidt, Lutz" To: "Lindenmaier, Goetz" , Andrew Leonard , "s390x-port-dev at openjdk.java.net" Date: 22/08/2018 16:50 Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors Hi Andrew, just recently I was confronted with a similar "shift issue" which prompted me to read the language standard (again). I have summarized my understanding in a little text file which you may find attached. Have fun reading! Best Regards, Lutz On 22.08.18, 09:18, "s390x-port-dev on behalf of Lindenmaier, Goetz" wrote: Hi Andrew, please post this RFR to core-libs-dev. s390x-prot-dev is only for questions about the port etc. It is not for reviews that go to jdk/jdk. Also, I'm not sure that your change in java.desktop is correct. You now negate after shifting. - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + mlib_u64 emask = (mlib_u64)-(((mlib_s64)1) >> ((8 - (size - i)) * 8)); before, -1 >> 3 will result in something like 000111...111 now -(1>>3) will result in 000....0000 Best regards, Goetz. > -----Original Message----- > From: s390x-port-dev On > Behalf Of Andrew Leonard > Sent: Dienstag, 21. August 2018 15:05 > To: s390x-port-dev at openjdk.java.net > Subject: RFR JDK-8209786: gcc 7.3 compiler errors > > Hi, > We have discovered issues with gcc 7.3 on zLinux, combined with OpenJDK's > default compiler options has highlighted a couple of native code issues, > with: > - validating loop test array bounds > - left shifts of negative values > I have created bug https://bugs.openjdk.java.net/browse/JDK-8209786 > and attached the webrev fix here: > http://cr.openjdk.java.net/~aleonard/gcc73/webrev.00/ > > I'd like to request a sponsor for this fix please? > > Many thanks > Andrew > > Andrew Leonard > Java Runtimes Development > IBM Hursley > IBM United Kingdom Ltd > Phone internal: 245913, external: 01962 815913 > internet email: andrew_m_leonard at uk.ibm.com > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 > 3AU [attachment "cppShiftOperations.txt" deleted by Andrew Leonard/UK/IBM] Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From andrew_m_leonard at uk.ibm.com Thu Aug 23 14:53:28 2018 From: andrew_m_leonard at uk.ibm.com (Andrew Leonard) Date: Thu, 23 Aug 2018 15:53:28 +0100 Subject: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors In-Reply-To: References: ; <3A00F18A-CC4D-4DCA-A7D8-18F5DB003B45@sap.com> Message-ID: Thanks Keith, Yes, that makes more sense and would be a defined behaviour. I will put together a new patch and also publish it to core-libs as suggested. Thanks Andrew Andrew Leonard Java Runtimes Development IBM Hursley IBM United Kingdom Ltd Phone internal: 245913, external: 01962 815913 internet email: andrew_m_leonard at uk.ibm.com From: Keith Campbell/Ottawa/IBM To: Andrew Leonard/UK/IBM at IBMGB Cc: goetz.lindenmaier at sap.com, joe.darcy at oracle.com, lutz.schmidt at sap.com, s390x-port-dev at openjdk.java.net Date: 23/08/2018 14:03 Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors I agree, -(1>>3) isn't what we want, but leaving it as it was isn't guaranteed to yield the desired result. Instead, I suggest the right shifts should be applied to unsigned values: - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + mlib_u64 emask = ((mlib_u64)(-1)) >> ((8 - (size - i)) * 8) -Keith ----- Original message ----- From: Andrew Leonard/UK/IBM To: "Schmidt, Lutz" , joe.darcy at oracle.com Cc: "Lindenmaier, Goetz" , "s390x-port-dev at openjdk.java.net" , Keith Campbell/Ottawa/IBM at IBMCA Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors Date: Thu, Aug 23, 2018 4:05 AM Thanks for the reviews guys, Lutz, yes, those "undefined" behaviour's is what gcc7.3 is now highlighting, and we're trying to fix. Goetz, I see what you're saying, I think we should leave the right shifts alone then, although as stated in Lutz's doc reference they are implementation-defined, I think the original code is trying to achieve the former 000111...111, I doubt it was trying to achieve 0! before, -1 >> 3 will result in something like 000111...111 now -(1>>3) will result in 000....0000 It is the left shirt of -ve values that is the real concern. Joe, also suggested we should tackle this by changing the compiler options rather than changing libfdlibm, which maybe the alternative as this source has not changed for a long time and maybe best to let working code remain unchanged, i'd have to investigate a compiler option fix... Keith, do you have any other views? Thanks Andrew Andrew Leonard Java Runtimes Development IBM Hursley IBM United Kingdom Ltd Phone internal: 245913, external: 01962 815913 internet email: andrew_m_leonard at uk.ibm.com "Schmidt, Lutz" ---22/08/2018 16:50:27---Hi Andrew, just recently I was confronted with a similar "shift issue" which prompted me to read th From: "Schmidt, Lutz" To: "Lindenmaier, Goetz" , Andrew Leonard , "s390x-port-dev at openjdk.java.net" Date: 22/08/2018 16:50 Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors Hi Andrew, just recently I was confronted with a similar "shift issue" which prompted me to read the language standard (again). I have summarized my understanding in a little text file which you may find attached. Have fun reading! Best Regards, Lutz On 22.08.18, 09:18, "s390x-port-dev on behalf of Lindenmaier, Goetz" wrote: Hi Andrew, please post this RFR to core-libs-dev. s390x-prot-dev is only for questions about the port etc. It is not for reviews that go to jdk/jdk. Also, I'm not sure that your change in java.desktop is correct. You now negate after shifting. - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); + mlib_u64 emask = (mlib_u64)-(((mlib_s64)1) >> ((8 - (size - i)) * 8)); before, -1 >> 3 will result in something like 000111...111 now -(1>>3) will result in 000....0000 Best regards, Goetz. > -----Original Message----- > From: s390x-port-dev On > Behalf Of Andrew Leonard > Sent: Dienstag, 21. August 2018 15:05 > To: s390x-port-dev at openjdk.java.net > Subject: RFR JDK-8209786: gcc 7.3 compiler errors > > Hi, > We have discovered issues with gcc 7.3 on zLinux, combined with OpenJDK's > default compiler options has highlighted a couple of native code issues, > with: > - validating loop test array bounds > - left shifts of negative values > I have created bug https://bugs.openjdk.java.net/browse/JDK-8209786 > and attached the webrev fix here: > http://cr.openjdk.java.net/~aleonard/gcc73/webrev.00/ > > I'd like to request a sponsor for this fix please? > > Many thanks > Andrew > > Andrew Leonard > Java Runtimes Development > IBM Hursley > IBM United Kingdom Ltd > Phone internal: 245913, external: 01962 815913 > internet email: andrew_m_leonard at uk.ibm.com > > > Unless stated otherwise above: > IBM United Kingdom Limited - Registered in England and Wales with number > 741598. > Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 > 3AU [attachment "cppShiftOperations.txt" deleted by Andrew Leonard/UK/IBM] Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU From goetz.lindenmaier at sap.com Fri Aug 24 07:20:18 2018 From: goetz.lindenmaier at sap.com (Lindenmaier, Goetz) Date: Fri, 24 Aug 2018 07:20:18 +0000 Subject: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors In-Reply-To: References: , <3A00F18A-CC4D-4DCA-A7D8-18F5DB003B45@sap.com> Message-ID: <82ca431095d14efc865f4700b911fb85@sap.com> Hi, maybe use -1LL or 0xfff...ULL ... But please, this is still not the right list to discuss this. Best regards, Goetz. > -----Original Message----- > From: Keith Campbell > Sent: Donnerstag, 23. August 2018 15:04 > To: Andrew Leonard > Cc: Lindenmaier, Goetz ; > joe.darcy at oracle.com; Schmidt, Lutz ; s390x-port- > dev at openjdk.java.net > Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors > > I agree, -(1>>3) isn't what we want, but leaving it as it was isn't guaranteed to > yield the desired result. > > Instead, I suggest the right shifts should be applied to unsigned values: > - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8); > + mlib_u64 emask = ((mlib_u64)(-1)) >> ((8 - (size - i)) * 8) > > -Keith > > > ----- Original message ----- > From: Andrew Leonard/UK/IBM > To: "Schmidt, Lutz" , joe.darcy at oracle.com > Cc: "Lindenmaier, Goetz" , "s390x- > port-dev at openjdk.java.net" , Keith > Campbell/Ottawa/IBM at IBMCA > Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors > Date: Thu, Aug 23, 2018 4:05 AM > > Thanks for the reviews guys, > Lutz, yes, those "undefined" behaviour's is what gcc7.3 is now > highlighting, and we're trying to fix. > > Goetz, I see what you're saying, I think we should leave the right > shifts alone then, although as stated in Lutz's doc reference they are > implementation-defined, I think the original code is trying to achieve the > former 000111...111, I doubt it was trying to achieve 0! > before, -1 >> 3 will result in something like 000111...111 > now -(1>>3) will result in 000....0000 > > It is the left shirt of -ve values that is the real concern. > > Joe, also suggested we should tackle this by changing the compiler > options rather than changing libfdlibm, which maybe the alternative as this > source has not changed for a long time and maybe best to let working code > remain unchanged, i'd have to investigate a compiler option fix... > > Keith, do you have any other views? > > Thanks > Andrew > > Andrew Leonard > Java Runtimes Development > IBM Hursley > IBM United Kingdom Ltd > Phone internal: 245913, external: 01962 815913 > internet email: andrew_m_leonard at uk.ibm.com > > > "Schmidt, Lutz" ---22/08/2018 16:50:27---Hi Andrew, just recently I > was confronted with a similar "shift issue" which prompted me to read th > > From: "Schmidt, Lutz" > To: "Lindenmaier, Goetz" , Andrew > Leonard , "s390x-port- > dev at openjdk.java.net" > Date: 22/08/2018 16:50 > Subject: Re: [CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors > ________________________________ > > > > > Hi Andrew, > just recently I was confronted with a similar "shift issue" which > prompted me to read the language standard (again). I have summarized my > understanding in a little text file which you may find attached. Have fun > reading! > Best Regards, > Lutz > > ?On 22.08.18, 09:18, "s390x-port-dev on behalf of Lindenmaier, Goetz" > goetz.lindenmaier at sap.com> wrote: > > Hi Andrew, > > please post this RFR to core-libs-dev. > > s390x-prot-dev is only for questions about the port etc. > It is not for reviews that go to jdk/jdk. > > Also, I'm not sure that your change in java.desktop is correct. > You now negate after shifting. > > - mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * > 8); > + mlib_u64 emask = (mlib_u64)-(((mlib_s64)1) >> ((8 - (size - i)) * > 8)); > > before, -1 >> 3 will result in something like 000111...111 > now -(1>>3) will result in 000....0000 > > Best regards, > Goetz. > > > > > > > > > > -----Original Message----- > > From: s390x-port-dev bounces at openjdk.java.net> On > > Behalf Of Andrew Leonard > > Sent: Dienstag, 21. August 2018 15:05 > > To: s390x-port-dev at openjdk.java.net > > Subject: RFR JDK-8209786: gcc 7.3 compiler errors > > > > Hi, > > We have discovered issues with gcc 7.3 on zLinux, combined with > OpenJDK's > > default compiler options has highlighted a couple of native code > issues, > > with: > > - validating loop test array bounds > > - left shifts of negative values > > I have created bug https://bugs.openjdk.java.net/browse/JDK- > 8209786 > > and attached the webrev fix here: > > http://cr.openjdk.java.net/~aleonard/gcc73/webrev.00/ > > > > I'd like to request a sponsor for this fix please? > > > > Many thanks > > Andrew > > > > Andrew Leonard > > Java Runtimes Development > > IBM Hursley > > IBM United Kingdom Ltd > > Phone internal: 245913, external: 01962 815913 > > internet email: andrew_m_leonard at uk.ibm.com > > > > > > Unless stated otherwise above: > > IBM United Kingdom Limited - Registered in England and Wales > with number > > 741598. > > Registered office: PO Box 41, North Harbour, Portsmouth, > Hampshire PO6 > > 3AU > > > [attachment "cppShiftOperations.txt" deleted by Andrew > Leonard/UK/IBM] > >