re PR middle-end/54486 (Spurious printf format warning mentions nonexistent type 'sizetype')

PR middle-end/54486
	* builtins.c (fold_builtin_strspn, fold_builtin_strcspn): Use
	build_int_cst with size_type_node instead of size_int.

	* c-c++-common/pr54486.c: New test.

From-SVN: r190986
This commit is contained in:
Jakub Jelinek 2012-09-05 18:27:55 +02:00 committed by Jakub Jelinek
parent 305b3c9bdc
commit 854f927236
4 changed files with 45 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2012-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/54486
* builtins.c (fold_builtin_strspn, fold_builtin_strcspn): Use
build_int_cst with size_type_node instead of size_int.
2012-09-05 Uros Bizjak <ubizjak@gmail.com>
* config/i386/sse.md (<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>):

View File

@ -11890,7 +11890,7 @@ fold_builtin_strspn (location_t loc, tree s1, tree s2)
if (p1 && p2)
{
const size_t r = strspn (p1, p2);
return size_int (r);
return build_int_cst (size_type_node, r);
}
/* If either argument is "", return NULL_TREE. */
@ -11935,7 +11935,7 @@ fold_builtin_strcspn (location_t loc, tree s1, tree s2)
if (p1 && p2)
{
const size_t r = strcspn (p1, p2);
return size_int (r);
return build_int_cst (size_type_node, r);
}
/* If the first argument is "", return NULL_TREE. */

View File

@ -1,3 +1,8 @@
2012-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/54486
* c-c++-common/pr54486.c: New test.
2012-09-05 Dominique Dhumieres <dominiq@lps.ens.fr>
PR fortran/54474

View File

@ -0,0 +1,32 @@
/* PR middle-end/54486 */
/* { dg-do compile } */
/* { dg-options "-Wformat" } */
#ifdef __cplusplus
extern "C" {
#endif
typedef __SIZE_TYPE__ size_t;
extern int printf (const char *, ...);
extern size_t strspn (const char *, const char *);
extern size_t strcspn (const char *, const char *);
extern size_t strlen (const char *);
#ifdef __cplusplus
}
#endif
void
foo (void)
{
printf ("%zu\n", strspn ("abc", "abcdefg"));
printf ("%zu\n", (size_t) strspn ("abc", "abcdefg"));
printf ("%zu\n", __builtin_strspn ("abc", "abcdefg"));
printf ("%zu\n", (size_t) __builtin_strspn ("abc", "abcdefg"));
printf ("%zu\n", strcspn ("abc", "abcdefg"));
printf ("%zu\n", (size_t) strcspn ("abc", "abcdefg"));
printf ("%zu\n", __builtin_strcspn ("abc", "abcdefg"));
printf ("%zu\n", (size_t) __builtin_strcspn ("abc", "abcdefg"));
printf ("%zu\n", strlen ("abc"));
printf ("%zu\n", (size_t) strlen ("abc"));
printf ("%zu\n", __builtin_strlen ("abc"));
printf ("%zu\n", (size_t) __builtin_strlen ("abc"));
}