[PATCH] Fix -Os related -Werror failures.

Florian Weimer fweimer@redhat.com
Fri Oct 28 06:32:00 GMT 2016


On 10/28/2016 06:46 AM, Carlos O'Donell wrote:
> +/* With GCC 5.3 when compiling with -Os the compiler emits a warning
> +   that buf[0] and buf[1] may be used uninitialized.  This can only
> +   happen in the case where tmpbuf[3] is used, and in that case the
> +   write to the tmpbuf[1] and tmpbuf[2] was assured because
> +   ucs4_to_cns11643 would have filled in those entries.  The difficulty
> +   is in getting the compiler to see this logic because tmpbuf[0] is
> +   involved in determining the code page and is the indicator that
> +   tmpbuf[2] is initialized.  */
> +DIAG_PUSH_NEEDS_COMMENT;
> +DIAG_IGNORE_NEEDS_COMMENT (5.3, "-Wmaybe-uninitialized");

This hides the warning for -O2 builds as well, so I don't think this is 
a good idea.

Those who want to build with -Os or other special compiler flags should 
just configure with --disable-werror.  We can't account for every 
optimization someone might want to disable in their build.

Florian



More information about the Libc-alpha mailing list