Commit 000ba23d by Kaveh R. Ghazi Committed by Kaveh Ghazi

re PR middle-end/20109 (printf optimizations and non-ASCII character sets)

	PR middle-end/20109
	PR middle-end/25120
	* builtins.c (init_target_chars): New.
	(expand_builtin_printf, expand_builtin_fprintf,
	expand_builtin_sprintf, fold_builtin_sprintf,
	maybe_emit_sprintf_chk_warning, fold_builtin_sprintf_chk,
	fold_builtin_snprintf_chk, fold_builtin_printf,
	fold_builtin_fprintf): Check for matching format strings using
	the target charset.
	
testsuite:
	* gcc.dg/charset/builtin2.c: New test.

From-SVN: r107652
parent 8fdb0857
2005-11-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR middle-end/20109
PR middle-end/25120
* builtins.c (init_target_chars): New.
(expand_builtin_printf, expand_builtin_fprintf,
expand_builtin_sprintf, fold_builtin_sprintf,
maybe_emit_sprintf_chk_warning, fold_builtin_sprintf_chk,
fold_builtin_snprintf_chk, fold_builtin_printf,
fold_builtin_fprintf): Check for matching format strings using
the target charset.
2005-11-29 Paul Brook <paul@codesourcery.com>
* config.gcc: Do not use fixproto on m68k-elf.
......
2005-11-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/charset/builtin2.c: New test.
2005-11-28 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/compat/struct-layout-1_generate.c: Add -w option
/* Ensure that transformations of *printf are performed correctly
regardless of -fexec-charset. See PR 25120. */
/* { dg-do compile } */
/* { dg-require-iconv "IBM1047" } */
/* { dg-options "-O2 -fexec-charset=IBM1047" } */
/* { dg-final { scan-assembler-not "printf" } } */
/* { dg-final { scan-assembler-not "fprintf" } } */
/* { dg-final { scan-assembler-not "sprintf" } } */
#include <stdio.h>
void foo (char *dst, const char *src)
{
printf ("\n");
printf ("hello world\n");
printf ("%s", "\n");
printf ("%s", "hello world\n");
printf ("%c", '\n');
printf ("%s\n", "hello world");
printf ("%s\n", src);
fprintf (stdout, "\n");
fprintf (stdout, "hello world\n");
fprintf (stdout, "%s", "\n");
fprintf (stdout, "%s", "hello world\n");
fprintf (stdout, "%c", '\n');
fprintf (stdout, "%s", src);
sprintf (dst, "hello world\n");
sprintf (dst, "%s", src);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment