[OpenJDK 2D-Dev] RFR: 8266171: -Warray-bounds happens in imageioJPEG.c

Phil Race prr at openjdk.java.net
Thu Apr 29 20:57:51 UTC 2021


On Thu, 29 Apr 2021 07:10:33 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> We can see following compiler warnings in imageioJPEG.c on GCC 11.

src/java.desktop/share/native/libjavajpeg/imageioJPEG.c line 673:

> 671:         if (info->is_decompressor) {
> 672:             j_decompress_ptr dinfo = (j_decompress_ptr) info;
> 673: #ifdef __GNUC__

I know how these structs are defined but I am not sure how gcc can decide anything like this.
I'd almost worry if it were true that we had the other type despite what the flag said except I can't
imagine gcc is doing even any static analysis of the code calling sequence and you may even need a dynamic analysis for this.

Have you submitted a gcc bug ?
Why is it only complaining in this branch ?
Have you considered disabling the warning in the make files - with broader scope of course - but a simpler change ?

Is 520 bytes the actual size of the compress struct ? And even then I am not sure I know what the compiler message means. so long as we have the right starting address free will only free what was allocated ... surely ...

-------------

PR: https://git.openjdk.java.net/jdk/pull/3788


More information about the 2d-dev mailing list