[OpenJDK 2D-Dev] RFR JDK-8209786: gcc 7.3 compiler errors on zLinux

Andrew Leonard andrew_m_leonard at uk.ibm.com
Fri Aug 31 09:14:34 UTC 2018


Hi,
So there seems to be varying opinion here, taking the 2D view point since 
it is going to be maintained, the opinion seems to be more with the fix (
http://cr.openjdk.java.net/~aleonard/8209786/webrev.00/). This would be my 
personal preference also, but previous comments seemed to prefer compiler 
options.

Looking at each error:
- /libfdlibm/k_rem_pio2.c : This is a simple "for" loop bound check, which 
with good programming practice should really have been there to prevent 
ArrayOutOfBounds.. or native overwrites.. Simple fix.
- libmlib_image/mlib_ImageLookUp_Bit.c : This is -ve bit shifting which is 
spec undefined, which in theory could mean it breaks in the future if we 
upgrade/change compiler... However, this is complex code, we need to be 
very sure the new fix is "correct", myself and my colleague here have 
examined it closely and are happy, but i'd appreciate your in-depth 
analysis please. 

Magnus, Philip, Brian, Goetz, can we have a vote? => "Fix" or 
"DisableWarnings" ?

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:   Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com>
To:     Philip Race <philip.race at oracle.com>, Brian Burkhalter 
<brian.burkhalter at oracle.com>
Cc:     2d-dev <2d-dev at openjdk.java.net>, build-dev 
<build-dev at openjdk.java.net>, Andrew Leonard 
<andrew_m_leonard at uk.ibm.com>, core-libs-dev 
<core-libs-dev at openjdk.java.net>
Date:   31/08/2018 09:27
Subject:        Re: [OpenJDK 2D-Dev] RFR JDK-8209786: gcc 7.3 compiler 
errors on zLinux



On 2018-08-31 01:28, Philip Race wrote:
> Some day, I'd like to replace a lot of medialib functionality with 
> something
> like the proposed Vector API. But that is far enough away that 
> medialib needs
> to be maintained, and unlike a previous discussion about a similar 
> issue in
> the JPEG library, we are on the hook for maintaining medialib.
> So if there is an actual logic error in medialib, I'd prefer to fix it.
> If the issue is a false positive, I'd be OK to disable the warning, 
> but wrapped
> in a platform-specific manner. So is it a real error here ?

Gcc is emitting a warning due to shifting of negative values, which is 
deemed undefined behavior by the spec.

Is this a real error? Well. Undefined behavior is no good. It can work 
for now and then suddenly start breaking.

The originally suggested code change 
(
http://cr.openjdk.java.net/~aleonard/8209786/webrev.00
) seems 
reasonable to me. It is at the very least much clearer what the 
intention is. And it's conformant with the spec.

So I'd advocate using that fix, if you want to continue supporting the 
library.

/Magnus




>
> -phil.
>
> On 8/30/18, 3:37 PM, Brian Burkhalter wrote:
>> Hi Andrew,
>>
>> As noted in the issue comments, the fdlibm C code is obsolescent and 
>> eventually to be superseded by equivalent Java implementations. As 
>> for the mediaLib code being moribund I cannot speak but am copying 
>> 2d-dev which owns java.desktop.
>>
>> Thanks,
>>
>> Brian
>>
>> On Aug 30, 2018, at 6:03 AM, Andrew Leonard 
>> <andrew_m_leonard at uk.ibm.com <mailto:andrew_m_leonard at uk.ibm.com>> 
>> wrote:
>>
>>> Thanks Magnus,
>>> Yes, these libraries are moribound it seems, hence their preference 
>>> for compile options..
>>> Cheers
>>> 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 
>>> <mailto:andrew_m_leonard at uk.ibm.com>
>>>
>>>
>>>
>>>
>>> From: Magnus Ihse Bursie <magnus.ihse.bursie at oracle.com 
>>> <mailto:magnus.ihse.bursie at oracle.com>>
>>> To: Andrew Leonard <andrew_m_leonard at uk.ibm.com 
>>> <mailto:andrew_m_leonard at uk.ibm.com>>, Brian Burkhalter 
>>> <brian.burkhalter at oracle.com <mailto:brian.burkhalter at oracle.com>>
>>> Cc: core-libs-dev at openjdk.java.net 
>>> <mailto:core-libs-dev at openjdk.java.net>, build-dev 
>>> <build-dev at openjdk.java.net <mailto:build-dev at openjdk.java.net>>
>>> Date: 30/08/2018 13:49
>>> Subject: Re: RFR JDK-8209786: gcc 7.3 compiler errors on zLinux
>>> 
------------------------------------------------------------------------ 
>>>
>>>
>>>
>>>
>>> Andrew,
>>>
>>> If you want to make changes to the build system (files in make/*),
>>> please always include build-dev in the reviews.
>>>
>>> From a build point, this fix looks okay. My general preference is to
>>> fix shady code instead of disabling warnings, but in this case it's in
>>> two libraries that are either external or moribound, so if the
>>> maintainer's of the respective libraries want to avoid code changes, I
>>> accept that.
>>>
>>> /Magnus
>>>
>>>
>>> On 2018-08-30 14:18, Andrew Leonard wrote:
>>> > Hi Brian,
>>> > Thanks for taking a look at this, I have just done a rebuild with 
>>> a new
>>> > patch with appropriate gcc disable warnings for these libraries:
>>> > 
http://cr.openjdk.java.net/~aleonard/8209786/webrev.01/ 

>>> <
http://cr.openjdk.java.net/%7Ealeonard/8209786/webrev.01/
>
>>> > This works fine, so if you think this is a more favourable 
>>> approach for
>>> > these libraries? i'd like to get this merged please.
>>> > 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 
>>> <mailto:andrew_m_leonard at uk.ibm.com>
>>> >
>>> >
>>> >
>>> >
>>> > From:   Brian Burkhalter <brian.burkhalter at oracle.com 
>>> <mailto:brian.burkhalter at oracle.com>>
>>> > To:     Andrew Leonard <andrew_m_leonard at uk.ibm.com 
>>> <mailto:andrew_m_leonard at uk.ibm.com>>
>>> > Cc: core-libs-dev at openjdk.java.net 
>>> <mailto:core-libs-dev at openjdk.java.net>
>>> > Date:   28/08/2018 15:52
>>> > Subject:        Re: RFR JDK-8209786: gcc 7.3 compiler errors on 
>>> zLinux
>>> >
>>> >
>>> >
>>> > Hi Andrew,
>>> >
>>> > It was suggested that it would be preferable to dial down the 
>>> compilation
>>> > settings for the fdlibm code rather than make a source code 
>>> change. Was
>>> > this investigated?
>>> >
>>> > Thanks,
>>> >
>>> > Brian
>>> >
>>> > On Aug 28, 2018, at 7:18 AM, Andrew Leonard 
>>> <andrew_m_leonard at uk.ibm.com <mailto:andrew_m_leonard at uk.ibm.com>>
>>> > wrote:
>>> >
>>> > 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 undefined behaviours:
>>> >   - 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/8209786/webrev.00/ 

>>> <
http://cr.openjdk.java.net/%7Ealeonard/8209786/webrev.00/
>
>>> >
>>> > This has already been discussed and refined on the "s390x-port-dev"
>>> > maillist
>>> > and as it was pointed out, it should have been posted here...
>>> >
>>> > I'd like to request a sponsor for this fix please?
>>> >
>>> >
>>> >
>>> >
>>> > 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
>>>
>>>
>>>
>>>
>>>
>>>
>>> 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
>>






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 build-dev mailing list