[CAUTION] RE: RFR JDK-8209786: gcc 7.3 compiler errors

Andrew Leonard andrew_m_leonard at uk.ibm.com
Thu Aug 23 14:53:28 UTC 2018


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" <lutz.schmidt at sap.com>, joe.darcy at oracle.com
Cc: "Lindenmaier, Goetz" <goetz.lindenmaier at sap.com>, 
"s390x-port-dev at openjdk.java.net" <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" <lutz.schmidt at sap.com>
To: "Lindenmaier, Goetz" <goetz.lindenmaier at sap.com>, Andrew Leonard 
<andrew_m_leonard at uk.ibm.com>, "s390x-port-dev at openjdk.java.net" 
<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" 
<s390x-port-dev-bounces at openjdk.java.net on behalf of 
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 <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] 
 



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


More information about the s390x-port-dev mailing list