gcc 7.3.1 build - warnings as errors in harfbuzz

Volker Simonis volker.simonis at gmail.com
Wed Oct 10 17:26:33 UTC 2018


Hi Matthias,

I've looked a little at this error and it is quite strange. First of
all, I can't reproduce it with a default gcc 7.3.0 and there doesn't
exist an official version of gcc 7.3.1 (at least I couldn't find it).
Also, I can't see the real error in the objected code. The values the
warning prints ("assuming directive output of 2147488582 bytes" and
"output 2 or more bytes (assuming 2147488583) into a destination of
size 127") seem to be excessively large. Every other reference for
this warning I could google reports much small numbers and I don't see
how a double could potentially use 2147488583 characters in the output
buffer.

Could this be a problem with the compiler you've used? Could you also
ask the people who compiled and patched it?

I did found the GCC bug "[7 Regression] -Wformat-overflow false
positive exceeding INT_MAX in glibc sysdeps/posix/tempname.c" [1]
which seem to resemble to the output you see, but that should have
been fixed  already in the 7.0 release.

Regards,
Volker

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79275

On Wed, Oct 10, 2018 at 3:14 PM Baesken, Matthias
<matthias.baesken at sap.com> wrote:
>
> Hello  , when  compiling   jdk/jdk   with  gcc 7.3.1    on linux x86_64 (or also on   linux ppc64)   I run into this build error :
>
>
> /open_jdk/jdk_just_clone/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc: In function 'void hb_variation_to_string(hb_variation_t*, char*, unsigned int)':
> /open_jdk/jdk_just_clone/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc:1066:27: error: '%g' directive output between 1 and 18446744073709551615 bytes may cause result to exceed 'INT_MAX' [-Werror=format-truncation=]
>    len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", variation->value));
>                   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /open_jdk/jdk_just_clone/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-common.cc:1066:27: note: assuming directive output of 2147488582 bytes
> cc1plus: all warnings being treated as errors
>
> (build is a product - build)
>
> Setting –disable-warnings-as-errors  works  as a workaround  ,  but of course this is not really   what we want to do .
>
> Fixing  in the    harfbuzz   sources  in OpenJDk  might be also not so nice because it would clash with imports of new versions of harfbuzz .
> Do you think we could disable  the specific warning for the library compilation ?
>
> Any other great suggestions ?
>
>
> Thanks, Matthias



More information about the build-dev mailing list