/usr/src/gcc-4.9/debian/patches/pr61294.diff is in gcc-4.9-source 4.9.3-13ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | # DP: PR middle-end/61294, -Wmemset-transposed-args
gcc/testsuite/
2014-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/61294
* c-c++-common/Wmemset-transposed-args1.c: New test.
* c-c++-common/Wmemset-transposed-args2.c: New test.
* g++.dg/warn/Wmemset-transposed-args-1.C: New test.
gcc/c-family/
2014-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/61294
* c.opt (Wmemset-transposed-args): New warning.
gcc/c/
2014-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/61294
* c-parser.c (c_parser_expr_list): Add new argument literal_zero_mask.
If non-NULL, call c_parser_check_literal_zero.
(c_parser_check_literal_zero): New function.
(c_parser_postfix_expression_after_primary): Adjust
c_parser_expr_list caller, handle -Wmemset-transposed-args.
gcc/cp/
2014-07-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/61294
* cp-tree.h (LITERAL_ZERO_P): Define.
* parser.c (cp_parser_parenthesized_expression_list): Add
want_literal_zero_p argument, if true, for literal zeros
insert INTEGER_CSTs with LITERAL_ZERO_P flag set.
(cp_parser_postfix_expression): Adjust
cp_parser_parenthesized_expression_list caller, handle
-Wmemset-transposed-args.
(literal_zeros): New variable.
Index: b/src/gcc/c/c-parser.c
===================================================================
--- a/src/gcc/c/c-parser.c
+++ b/src/gcc/c/c-parser.c
@@ -1203,7 +1203,8 @@ static struct c_expr c_parser_expression
static struct c_expr c_parser_expression_conv (c_parser *);
static vec<tree, va_gc> *c_parser_expr_list (c_parser *, bool, bool,
vec<tree, va_gc> **, location_t *,
- tree *, vec<location_t> *);
+ tree *, vec<location_t> *,
+ unsigned int * = NULL);
static void c_parser_omp_construct (c_parser *);
static void c_parser_omp_threadprivate (c_parser *);
static void c_parser_omp_barrier (c_parser *);
@@ -7625,6 +7626,7 @@ c_parser_postfix_expression_after_primar
tree ident, idx;
location_t sizeof_arg_loc[3];
tree sizeof_arg[3];
+ unsigned int literal_zero_mask;
unsigned int i;
vec<tree, va_gc> *exprlist;
vec<tree, va_gc> *origtypes = NULL;
@@ -7679,12 +7681,13 @@ c_parser_postfix_expression_after_primar
sizeof_arg[i] = NULL_TREE;
sizeof_arg_loc[i] = UNKNOWN_LOCATION;
}
+ literal_zero_mask = 0;
if (c_parser_next_token_is (parser, CPP_CLOSE_PAREN))
exprlist = NULL;
else
exprlist = c_parser_expr_list (parser, true, false, &origtypes,
sizeof_arg_loc, sizeof_arg,
- &arg_loc);
+ &arg_loc, &literal_zero_mask);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN,
"expected %<)%>");
orig_expr = expr;
@@ -7694,6 +7697,19 @@ c_parser_postfix_expression_after_primar
expr.value, exprlist,
sizeof_arg,
sizeof_ptr_memacc_comptypes);
+ if (warn_memset_transposed_args
+ && TREE_CODE (expr.value) == FUNCTION_DECL
+ && DECL_BUILT_IN_CLASS (expr.value) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (expr.value) == BUILT_IN_MEMSET
+ && vec_safe_length (exprlist) == 3
+ && integer_zerop ((*exprlist)[2])
+ && (literal_zero_mask & (1 << 2)) != 0
+ && (!integer_zerop ((*exprlist)[1])
+ || (literal_zero_mask & (1 << 1)) == 0))
+ warning_at (expr_loc, OPT_Wmemset_transposed_args,
+ "%<memset%> used with constant zero length parameter; "
+ "this could be due to transposed parameters");
+
expr.value
= c_build_function_call_vec (expr_loc, arg_loc, expr.value,
exprlist, origtypes);
@@ -7861,6 +7877,36 @@ c_parser_expression_conv (c_parser *pars
return expr;
}
+/* Helper function of c_parser_expr_list. Check if IDXth (0 based)
+ argument is a literal zero alone and if so, set it in literal_zero_mask. */
+
+static inline void
+c_parser_check_literal_zero (c_parser *parser, unsigned *literal_zero_mask,
+ unsigned int idx)
+{
+ if (idx >= HOST_BITS_PER_INT)
+ return;
+
+ c_token *tok = c_parser_peek_token (parser);
+ switch (tok->type)
+ {
+ case CPP_NUMBER:
+ case CPP_CHAR:
+ case CPP_WCHAR:
+ case CPP_CHAR16:
+ case CPP_CHAR32:
+ /* If a parameter is literal zero alone, remember it
+ for -Wmemset-transposed-args warning. */
+ if (integer_zerop (tok->value)
+ && !TREE_OVERFLOW (tok->value)
+ && (c_parser_peek_2nd_token (parser)->type == CPP_COMMA
+ || c_parser_peek_2nd_token (parser)->type == CPP_CLOSE_PAREN))
+ *literal_zero_mask |= 1U << idx;
+ default:
+ break;
+ }
+}
+
/* Parse a non-empty list of expressions. If CONVERT_P, convert
functions and arrays to pointers and lvalues to rvalues. If
FOLD_P, fold the expressions. If LOCATIONS is non-NULL, save the
@@ -7875,7 +7921,8 @@ static vec<tree, va_gc> *
c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p,
vec<tree, va_gc> **p_orig_types,
location_t *sizeof_arg_loc, tree *sizeof_arg,
- vec<location_t> *locations)
+ vec<location_t> *locations,
+ unsigned int *literal_zero_mask)
{
vec<tree, va_gc> *ret;
vec<tree, va_gc> *orig_types;
@@ -7893,6 +7940,8 @@ c_parser_expr_list (c_parser *parser, bo
if (sizeof_arg != NULL
&& c_parser_next_token_is_keyword (parser, RID_SIZEOF))
cur_sizeof_arg_loc = c_parser_peek_2nd_token (parser)->location;
+ if (literal_zero_mask)
+ c_parser_check_literal_zero (parser, literal_zero_mask, 0);
expr = c_parser_expr_no_commas (parser, NULL);
if (convert_p)
expr = convert_lvalue_to_rvalue (loc, expr, true, true);
@@ -7919,6 +7968,8 @@ c_parser_expr_list (c_parser *parser, bo
cur_sizeof_arg_loc = c_parser_peek_2nd_token (parser)->location;
else
cur_sizeof_arg_loc = UNKNOWN_LOCATION;
+ if (literal_zero_mask)
+ c_parser_check_literal_zero (parser, literal_zero_mask, idx + 1);
expr = c_parser_expr_no_commas (parser, NULL);
if (convert_p)
expr = convert_lvalue_to_rvalue (loc, expr, true, true);
Index: b/src/gcc/c-family/c.opt
===================================================================
--- a/src/gcc/c-family/c.opt
+++ b/src/gcc/c-family/c.opt
@@ -494,6 +494,10 @@ Wmain
LangEnabledBy(C ObjC C++ ObjC++,Wpedantic, 2, 0)
;
+Wmemset-transposed-args
+C ObjC C++ ObjC++ Var(warn_memset_transposed_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not
+
Wmissing-braces
C ObjC C++ ObjC++ Var(warn_missing_braces) Warning LangEnabledBy(C ObjC,Wall)
Warn about possibly missing braces around initializers
Index: b/src/gcc/cp/cp-tree.h
===================================================================
--- a/src/gcc/cp/cp-tree.h
+++ b/src/gcc/cp/cp-tree.h
@@ -4185,6 +4185,10 @@ more_aggr_init_expr_args_p (const aggr_i
#define SIZEOF_EXPR_TYPE_P(NODE) \
TREE_LANG_FLAG_0 (SIZEOF_EXPR_CHECK (NODE))
+/* True if INTEGER_CST is a zero literal seen in function argument list. */
+#define LITERAL_ZERO_P(NODE) \
+ (INTEGER_CST_CHECK (NODE)->base.nothrow_flag)
+
/* An enumeration of the kind of tags that C++ accepts. */
enum tag_types {
none_type = 0, /* Not a tag type. */
Index: b/src/gcc/cp/parser.c
===================================================================
--- a/src/gcc/cp/parser.c
+++ b/src/gcc/cp/parser.c
@@ -1921,7 +1921,7 @@ static tree cp_parser_postfix_open_squar
static tree cp_parser_postfix_dot_deref_expression
(cp_parser *, enum cpp_ttype, tree, bool, cp_id_kind *, location_t);
static vec<tree, va_gc> *cp_parser_parenthesized_expression_list
- (cp_parser *, int, bool, bool, bool *);
+ (cp_parser *, int, bool, bool, bool *, bool = false);
/* Values for the second parameter of cp_parser_parenthesized_expression_list. */
enum { non_attr = 0, normal_attr = 1, id_attr = 2 };
static void cp_parser_pseudo_destructor_name
@@ -6037,7 +6037,8 @@ cp_parser_postfix_expression (cp_parser
args = (cp_parser_parenthesized_expression_list
(parser, non_attr,
/*cast_p=*/false, /*allow_expansion_p=*/true,
- /*non_constant_p=*/NULL));
+ /*non_constant_p=*/NULL,
+ /*want_literal_zero_p=*/warn_memset_transposed_args));
if (is_builtin_constant_p)
{
parser->integral_constant_expression_p
@@ -6105,6 +6106,30 @@ cp_parser_postfix_expression (cp_parser
}
}
+ if (warn_memset_transposed_args)
+ {
+ if (TREE_CODE (postfix_expression) == FUNCTION_DECL
+ && DECL_BUILT_IN_CLASS (postfix_expression) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (postfix_expression) == BUILT_IN_MEMSET
+ && vec_safe_length (args) == 3
+ && integer_zerop ((*args)[2])
+ && LITERAL_ZERO_P ((*args)[2])
+ && !(integer_zerop ((*args)[1])
+ && LITERAL_ZERO_P ((*args)[1])))
+ warning (OPT_Wmemset_transposed_args,
+ "%<memset%> used with constant zero length "
+ "parameter; this could be due to transposed "
+ "parameters");
+
+ /* Replace LITERAL_ZERO_P INTEGER_CSTs with normal ones
+ to avoid leaking those into folder and middle-end. */
+ unsigned int i;
+ tree arg;
+ FOR_EACH_VEC_SAFE_ELT (args, i, arg)
+ if (TREE_CODE (arg) == INTEGER_CST && LITERAL_ZERO_P (arg))
+ (*args)[i] = build_int_cst (TREE_TYPE (arg), 0);
+ }
+
if (TREE_CODE (postfix_expression) == COMPONENT_REF)
{
tree instance = TREE_OPERAND (postfix_expression, 0);
@@ -6593,6 +6618,10 @@ cp_parser_postfix_dot_deref_expression (
return postfix_expression;
}
+/* Cache of LITERAL_ZERO_P constants. */
+
+static GTY(()) tree literal_zeros[itk_none];
+
/* Parse a parenthesized expression-list.
expression-list:
@@ -6617,14 +6646,18 @@ cp_parser_postfix_dot_deref_expression (
plain identifier argument, normal_attr for an attribute that wants
an expression, or non_attr if we aren't parsing an attribute list. If
NON_CONSTANT_P is non-NULL, *NON_CONSTANT_P indicates whether or
- not all of the expressions in the list were constant. */
+ not all of the expressions in the list were constant.
+ WANT_LITERAL_ZERO_P is true if the caller is interested in
+ LITERAL_ZERO_P INTEGER_CSTs. FIXME: once we don't fold everything
+ immediately, this can be removed. */
static vec<tree, va_gc> *
cp_parser_parenthesized_expression_list (cp_parser* parser,
int is_attribute_list,
bool cast_p,
bool allow_expansion_p,
- bool *non_constant_p)
+ bool *non_constant_p,
+ bool want_literal_zero_p)
{
vec<tree, va_gc> *expression_list;
bool fold_expr_p = is_attribute_list != non_attr;
@@ -6687,7 +6720,50 @@ cp_parser_parenthesized_expression_list
*non_constant_p = true;
}
else
- expr = cp_parser_assignment_expression (parser, cast_p, NULL);
+ {
+ expr = NULL_TREE;
+ cp_token *tok = cp_lexer_peek_token (parser->lexer);
+ switch (tok->type)
+ {
+ case CPP_NUMBER:
+ case CPP_CHAR:
+ case CPP_WCHAR:
+ case CPP_CHAR16:
+ case CPP_CHAR32:
+ /* If a parameter is literal zero alone, remember it
+ for -Wmemset-transposed-args warning. */
+ if (integer_zerop (tok->u.value)
+ && !TREE_OVERFLOW (tok->u.value)
+ && want_literal_zero_p
+ && (cp_lexer_peek_nth_token (parser->lexer, 2)->type
+ == CPP_COMMA
+ || cp_lexer_peek_nth_token (parser->lexer, 2)->type
+ == CPP_CLOSE_PAREN))
+ {
+ unsigned int i;
+ for (i = 0; i < itk_none; ++i)
+ if (TREE_TYPE (tok->u.value) == integer_types[i])
+ break;
+ if (i < itk_none && literal_zeros[i])
+ expr = literal_zeros[i];
+ else
+ {
+ expr = copy_node (tok->u.value);
+ LITERAL_ZERO_P (expr) = 1;
+ if (i < itk_none)
+ literal_zeros[i] = expr;
+ }
+ /* Consume the 0 token (or '\0', 0LL etc.). */
+ cp_lexer_consume_token (parser->lexer);
+ }
+ break;
+ default:
+ break;
+ }
+ if (expr == NULL_TREE)
+ expr = cp_parser_assignment_expression (parser, cast_p,
+ NULL);
+ }
if (fold_expr_p)
expr = fold_non_dependent_expr (expr);
Index: b/src/gcc/testsuite/c-c++-common/Wmemset-transposed-args1.c
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/c-c++-common/Wmemset-transposed-args1.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+typedef __SIZE_TYPE__ size_t;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memset (void *, int, size_t);
+char buf[1024];
+
+void
+foo ()
+{
+ memset (buf, sizeof buf, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, '\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, L'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, 1, 1 - 1);
+ memset (buf, 1, 0 - 0);
+ memset (buf, 0, 0);
+ memset (buf, '\0', 0);
+ memset (buf, L'\0', 0);
+ memset (buf, 1 - 1, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, 0 - 0, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0L); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0UL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0LL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0ULL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, (int) 0);
+ memset (buf, sizeof buf, -0);
+}
Index: b/src/gcc/testsuite/c-c++-common/Wmemset-transposed-args2.c
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/c-c++-common/Wmemset-transposed-args2.c
@@ -0,0 +1,20 @@
+/* { dg-do compile { target { c || c++11 } } } */
+/* { dg-options "-Wall" } */
+/* { dg-additional-options "-std=gnu99" { target c } } */
+
+typedef __SIZE_TYPE__ size_t;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void *memset (void *, int, size_t);
+char buf[1024];
+
+void
+foo ()
+{
+ memset (buf, sizeof buf, u'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, U'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, u'\0', 0);
+ memset (buf, U'\0', 0);
+}
Index: b/src/gcc/testsuite/g++.dg/warn/Wmemset-transposed-args-1.C
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/g++.dg/warn/Wmemset-transposed-args-1.C
@@ -0,0 +1,74 @@
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *memset (void *, int, size_t);
+char buf[1024];
+namespace std
+{
+ extern "C" void *memset (void *, int, size_t);
+}
+
+template <int N>
+void
+foo ()
+{
+ memset (buf, sizeof buf, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, '\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, L'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, N);
+ memset (buf, 1, 1 - 1);
+ memset (buf, 1, 0 - 0);
+ memset (buf, 1, N - N);
+ memset (buf, 0, 0);
+ memset (buf, 1 - 1, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, 0 - 0, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0L); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0UL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0LL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, 0ULL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ memset (buf, sizeof buf, (int) 0);
+ memset (buf, sizeof buf, -0);
+}
+
+template <int N>
+void
+baz ()
+{
+ std::memset (buf, sizeof buf, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, '\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, L'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, N);
+ std::memset (buf, 1, 1 - 1);
+ std::memset (buf, 1, 0 - 0);
+ std::memset (buf, 1, N - N);
+ std::memset (buf, 0, 0);
+ std::memset (buf, 1 - 1, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, 0 - 0, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0L); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0UL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0LL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0ULL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, (int) 0);
+ std::memset (buf, sizeof buf, -0);
+}
+
+void
+bar ()
+{
+ foo<0> ();
+ std::memset (buf, sizeof buf, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, '\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, L'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, 1, 1 - 1);
+ std::memset (buf, 1, 0 - 0);
+ std::memset (buf, 0, 0);
+ std::memset (buf, 1 - 1, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, 0 - 0, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0L); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0UL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0LL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, 0ULL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
+ std::memset (buf, sizeof buf, (int) 0);
+ std::memset (buf, sizeof buf, -0);
+}
|