Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8300692

GCC 12 reports some compiler warnings in bundled freetype

XMLWordPrintable

    • b07


        If you run configure with `--with-freetype=bundled` and are using GCC 12.2.0, a number of `stringop-overflow` and `dangling-pointer` warnings are produced.


        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c: In function 'gray_convert_glyph':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1968:20: error: storing the address of local variable 'buffer' in '*worker.ycells' [-Werror=dangling-pointer=]
         1968 | ras.ycells = (PCell*)buffer;
              | ^
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'buffer' declared here
         1950 | TCell buffer[FT_MAX_GRAY_POOL];
              | ^~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'worker' declared here
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1961:26: error: storing the address of local variable 'buffer' in '*worker.cell_null' [-Werror=dangling-pointer=]
         1961 | ras.cell_null = buffer + FT_MAX_GRAY_POOL - 1;
              | ^
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'buffer' declared here
         1950 | TCell buffer[FT_MAX_GRAY_POOL];
              | ^~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'worker' declared here
        cc1: all warnings being treated as errors
        gmake[3]: *** [/src/jdk/build/linux-x86_64-server-release/support/native/java.desktop/libfreetype/ftgrays.o] Error 1
        gmake[3]: *** Waiting for unfinished jobs....
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c: In function 'load_truetype_glyph':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c:1691:22: error: storing the address of local variable 'inc_stream' in '*loader.stream' [-Werror=dangling-pointer=]
         1691 | loader->stream = &inc_stream;
              | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c:1624:21: note: 'inc_stream' declared here
         1624 | FT_StreamRec inc_stream;
              | ^~~~~~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c:1624:21: note: 'loader' declared here
        In function 'cf2_hintmask_read',
            inlined from 'cf2_hintmask_read' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:131:3,
            inlined from 'cf2_interpT2CharString' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:2640:11:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:156:25: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
          156 | hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
              | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In file included from /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:46:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/pshints.h: In function 'cf2_interpT2CharString':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/pshints.h:80:14: note: at offset 12 into destination object 'mask' of size 12
           80 | FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8];
              | ^~~~
        In function 'cf2_hintmask_read',
            inlined from 'cf2_hintmask_read' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:131:3,
            inlined from 'cf2_interpT2CharString' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:2609:11:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:156:25: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
          156 | hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
              | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/pshints.h: In function 'cf2_interpT2CharString':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/pshints.h:80:14: note: at offset 12 into destination object 'mask' of size 12
           80 | FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8];
              | ^~~~
        cc1: all warnings being treated as errors
        gmake[3]: *** [/src/jdk/build/linux-x86_64-server-release/support/native/java.desktop/libfreetype/psintrp.o] Error 1
        cc1: all warnings being treated as errors
        gmake[3]: *** [/src/jdk/build/linux-x86_64-server-release/support/native/java.desktop/libfreetype/ttgload.o] Error 1
        gmake[3]: *** wait: No child processes. Stop.
        gmake[2]: *** [java.desktop-libs] Error 1

        ERROR: Build failed for target 'images' in configuration 'linux-x86_64-server-release' (exit code 2)
        Stopping javac server

        === Output from failing command(s) repeated here ===
        * For target support_native_java.desktop_libfreetype_ftgrays.o:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c: In function 'gray_convert_glyph':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1968:20: error: storing the address of local variable 'buffer' in '*worker.ycells' [-Werror=dangling-pointer=]
         1968 | ras.ycells = (PCell*)buffer;
              | ^
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'buffer' declared here
         1950 | TCell buffer[FT_MAX_GRAY_POOL];
              | ^~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'worker' declared here
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1961:26: error: storing the address of local variable 'buffer' in '*worker.cell_null' [-Werror=dangling-pointer=]
         1961 | ras.cell_null = buffer + FT_MAX_GRAY_POOL - 1;
              | ^
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'buffer' declared here
         1950 | TCell buffer[FT_MAX_GRAY_POOL];
              | ^~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c:1950:14: note: 'worker' declared here
           ... (rest of output omitted)
        * For target support_native_java.desktop_libfreetype_psintrp.o:
        In function 'cf2_hintmask_read',
            inlined from 'cf2_hintmask_read' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:131:3,
            inlined from 'cf2_interpT2CharString' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:2640:11:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:156:25: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
          156 | hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
              | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In file included from /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:46:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/pshints.h: In function 'cf2_interpT2CharString':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/pshints.h:80:14: note: at offset 12 into destination object 'mask' of size 12
           80 | FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8];
              | ^~~~
        In function 'cf2_hintmask_read',
            inlined from 'cf2_hintmask_read' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:131:3,
            inlined from 'cf2_interpT2CharString' at /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:2609:11:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c:156:25: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
           ... (rest of output omitted)
        * For target support_native_java.desktop_libfreetype_ttgload.o:
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c: In function 'load_truetype_glyph':
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c:1691:22: error: storing the address of local variable 'inc_stream' in '*loader.stream' [-Werror=dangling-pointer=]
         1691 | loader->stream = &inc_stream;
              | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c:1624:21: note: 'inc_stream' declared here
         1624 | FT_StreamRec inc_stream;
              | ^~~~~~~~~~
        /src/jdk/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c:1624:21: note: 'loader' declared here
        cc1: all warnings being treated as errors

        * All command lines available in /src/jdk/build/linux-x86_64-server-release/make-support/failure-logs.
        === End of repeated output ===

        No indication of failed target found.
        HELP: Try searching the build log for '] Error'.
        HELP: Run 'make doctor' to diagnose build problems.

        make[1]: *** [main] Error 1
        make: *** [images] Error 2

              dlutker Dan Lutker
              dlutker Dan Lutker
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: