[PATCH] Build fails to compile jchuff.c using gcc 4.5 on zLinux
Erik Joelsson
erik.joelsson at oracle.com
Wed Jan 17 23:12:59 UTC 2018
This isn't really a question for build-dev. It should be brought to the
component team owning that particular source. I believe in this case
that would be 2d-dev.
/Erik
On 2018-01-17 03:48, Adam Farley8 wrote:
> Hi All,
>
> If you compile jchuff.c (part of javajpeg) without
> "--disable-warnings-as-errors",
> then you get an error that kills the build. This is seen in these
> circumstances:
>
> Build: JDK9
> gcc and g++ Version: 4.8.5
> Platform: zLinux 64bit (s390x)
>
> The error message is:
>
> /home/adamfarl/hotspot/jdk9/jdk/src/java.desktop/share/native/libjavajpeg/jchuff.c:
> In function 'jGenOptTbl':
> /home/adamfarl/hotspot/jdk9/jdk/src/java.desktop/share/native/libjavajpeg/jchuff.c:808:18:
> error: array subscript is below array bounds [-Werror=array-bounds]
> while (bits[j] == 0)
> ^
>
> It looks to me that this error happens because the while loop can
> technically
> reduce j down to beneath 0, resulting in us attempting to find the array
> entry
> with index -1.
>
> On the basis that if we get down to -1 here bad things will happen
> regardless,
> perhaps we should change that line to:
>
> while ((bits[j] == 0) && (j != 0))
>
> This appears to prevent the compiler failing with this error, by providing
>
> unambiguous handling for the "index -1" scenario.
>
> Thoughts?
>
> Best Regards
>
> Adam Farley
>
> 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