This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 26 Apr 2017 22:26:56 +0000
- Subject: Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503)
- Authentication-results: sourceware.org; auth=none
- References: <055b63b9-2303-6031-021c-c216e94ed072@gmail.com>
On Wed, 26 Apr 2017, Martin Sebor wrote:
> Testing my solution for bug 77671 (missing -Wformat-overflow
> sprintf with "%s") caused a regression in the charset/builtin2.c
> test for bug 25120 (builtin *printf handlers are confused by
> -fexec-charset). That led me to realize that like -Wformat
> itself, the whole gimple-ssa-sprintf pass is oblivious to
> potential differences between the source character set on
> the host and the execution character set on the target. As
> a result, when the host and target sets are different, the
> pass misinterprets ordinary format characters as special
> (e.g., parts of directives) and vice versa.
>
> The attached patch implements a simple solution to this problem
> by introducing a mapping between the two sets.
target_strtol10 appears to do no checking for overflow, which I'd expect
would result in nonsensical results for large width values overflowing
host long (whereas strtol would reliably return LONG_MAX in such cases).
--
Joseph S. Myers
joseph@codesourcery.com