Commit 854f9272 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 305b3c9b
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>):
......
......@@ -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. */
......
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
......
/* 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"));
}
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