Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 583534

Summary: >=sys-devel/gcc-5.3.0: fails to compile with -Werror=format-security
Product: Gentoo Linux Reporter: Sam Jorna (wraeth) <wraeth>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED UPSTREAM    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 259417    
Attachments: build.log
gcc-build-logs.tar.bz2
gcc-5.4.0-r2-build.log
gcc-8.2.0-r4 build.log

Description Sam Jorna (wraeth) gentoo-dev 2016-05-20 02:59:56 UTC
Created attachment 434754 [details]
build.log

Two instances of this are reported in my build.log:

> checking minix/config.h usability... /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/libcpp/expr.c: In function ‘unsigned int cpp_classify_number(cpp_reader*, const cpp_token*, const char**, source_location)’:
> /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/libcpp/expr.c:681:18: error: format not a string literal and no format arguments [-Werror=format-security]
>         0, message);
>                   ^    
> /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/libcpp/expr.c:684:39: error: format not a string literal and no format arguments [-Werror=format-security]
>            virtual_location, 0, message);
>                                        ^    
> cc1plus: some warnings being treated as errors
> Makefile:224: recipe for target 'expr.o' failed
> make[3]: *** [expr.o] Error 1

And:

> checking whether x86_64-pc-linux-gnu-gcc supports -Wstrict-prototypes... /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/libcpp/macro.c: In function ‘bool create_iso_definition(cpp_reader*, cpp_macro*)’:
> /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/libcpp/macro.c:3087:58: error: format not a string literal and no format arguments [-Werror=format-security]
>         cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
>                                                           ^
> /var/tmp/portage/sys-devel/gcc-5.3.0/work/gcc-5.3.0/libcpp/macro.c:3100:58: error: format not a string literal and no format arguments [-Werror=format-security]
>         cpp_error (pfile, CPP_DL_ERROR, paste_op_error_msg);
>                                                           ^
> cc1plus: some warnings being treated as errors
> Makefile:224: recipe for target 'macro.o' failed
> make[3]: *** [macro.o] Error 1
Comment 1 Sam Jorna (wraeth) gentoo-dev 2016-05-20 03:00:20 UTC
Created attachment 434756 [details]
gcc-build-logs.tar.bz2
Comment 2 Sam Jorna (wraeth) gentoo-dev 2017-01-08 05:28:24 UTC
Created attachment 459124 [details]
gcc-5.4.0-r2-build.log

This also occurs with sys-devel/gcc-5.4.0-r2.
Comment 3 Sam Jorna (wraeth) gentoo-dev 2018-11-06 10:00:35 UTC
Created attachment 554260 [details]
gcc-8.2.0-r4 build.log

This is still an issue with gcc-8.2.0-r4.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-21 22:30:53 UTC
That has to be fixed upstream. Non-literal format strings are common for gettext-like NLS code when format string comes from localization files.