+2019-05-31 Xiong Hu Luo <luoxhu@linux.ibm.com>
+
+ PR c/43673
+ * c-format.c (print_char_table, scanf_char_table): Replace BADLEN with
+ TEX_D32, TEX_D64 or TEX_D128.
+
2019-05-31 Marc Glisse <marc.glisse@inria.fr>
* match.pd (~(vec?cst1:cst2)): New transformation.
{ "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL },
/* C99 conversion specifiers. */
{ "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "-wp0 +#'I", "", NULL },
- { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "", NULL },
+ { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "-wp0 +#", "", NULL },
/* X/Open conversion specifiers. */
{ "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "", NULL },
{ "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R", NULL },
{ "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM, BADLEN, BADLEN, BADLEN }, "", "W", NULL },
/* C99 conversion specifiers. */
{ "F", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "*w'", "W", NULL },
- { "aA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*w'", "W", NULL },
+ { "aA", 1, STD_C99, { T99_F, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN, TEX_D32, TEX_D64, TEX_D128 }, "*w'", "W", NULL },
/* X/Open conversion specifiers. */
{ "C", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*mw", "W", NULL },
{ "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "*amw", "W", NULL },
+2019-05-31 Xiong Hu Luo <luoxhu@linux.ibm.com>
+
+ PR c/43673
+ * gcc.dg/format-dfp-printf-1.c: New test.
+ * gcc.dg/format-dfp-scanf-1.c: Likewise.
+
2019-05-31 Marc Glisse <marc.glisse@inria.fr>
* g++.dg/tree-ssa/cprop-vcond.C: New file.
/* Check lack of warnings for valid usage. */
+ printf ("%Ha\n", x);
+ printf ("%HA\n", x);
printf ("%Hf\n", x);
printf ("%HF\n", x);
printf ("%He\n", x);
printf ("%Hg\n", x);
printf ("%HG\n", x);
+ printf ("%Da\n", y);
+ printf ("%DA\n", y);
printf ("%Df\n", y);
printf ("%DF\n", y);
printf ("%De\n", y);
printf ("%Dg\n", y);
printf ("%DG\n", y);
+ printf ("%DDa\n", z);
+ printf ("%DDA\n", z);
printf ("%DDf\n", z);
printf ("%DDF\n", z);
printf ("%DDe\n", z);
/* Check warnings for type mismatches. */
+ printf ("%Ha\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
+ printf ("%HA\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hf\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HF\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%He\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HE\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hg\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HG\n", y); /* { dg-warning "expects argument" "bad use of %H" } */
+ printf ("%Ha\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
+ printf ("%HA\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hf\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HF\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%He\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hg\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%HG\n", z); /* { dg-warning "expects argument" "bad use of %H" } */
+ printf ("%Da\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
+ printf ("%DA\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Df\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DF\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%De\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DE\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Dg\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DG\n", x); /* { dg-warning "expects argument" "bad use of %D" } */
+ printf ("%Da\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
+ printf ("%DA\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Df\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DF\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%De\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%Dg\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
printf ("%DG\n", z); /* { dg-warning "expects argument" "bad use of %D" } */
+ printf ("%DDa\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
+ printf ("%DDA\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDf\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDF\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDe\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDE\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDg\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDG\n", x); /* { dg-warning "expects argument" "bad use of %DD" } */
+ printf ("%DDa\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
+ printf ("%DDA\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDf\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDF\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%DDe\n", y); /* { dg-warning "expects argument" "bad use of %DD" } */
printf ("%Hu\n", j); /* { dg-warning "length" "bad use of %H" } */
printf ("%Hx\n", j); /* { dg-warning "length" "bad use of %H" } */
printf ("%HX\n", j); /* { dg-warning "length" "bad use of %H" } */
- printf ("%Ha\n", d); /* { dg-warning "length" "bad use of %H" } */
- printf ("%HA\n", d); /* { dg-warning "length" "bad use of %H" } */
+ printf ("%Ha\n", d); /* { dg-warning "expects argument" "bad use of %H" } */
+ printf ("%HA\n", d); /* { dg-warning "expects argument" "bad use of %H" } */
printf ("%Hc\n", i); /* { dg-warning "length" "bad use of %H" } */
printf ("%Hs\n", p); /* { dg-warning "length" "bad use of %H" } */
printf ("%Hp\n", p); /* { dg-warning "length" "bad use of %H" } */
/* Sanity checks for flags, field width, and precision in formats for
DFP types. */
+ printf ("%-Ha\n", x);
+ printf ("%+HA\n", x);
printf ("%-Hf\n", x);
printf ("%+HF\n", x);
printf ("% He\n", x);
printf ("%0Hg\n", x);
printf ("%#0HG\n", x);
+ printf ("%0#Da\n", y);
+ printf ("%0DA\n", y);
printf ("%0#Df\n", y);
printf ("%0DF\n", y);
printf ("%#De\n", y);
printf ("%-#0Dg\n", y); /* { dg-warning "flag ignored" "ignore flag" } */
printf ("%0+ DG\n", y); /* { dg-warning "flag ignored" "ignore flag" } */
+ printf ("%DDa\n", z);
+ printf ("%0DDA\n", z);
printf ("%DDf\n", z);
printf ("%0DDF\n", z);
printf ("%#0DDe\n", z);
/* Check lack of warnings for valid usage. */
+ scanf ("%Ha", x);
+ scanf ("%HA", x);
scanf ("%Hf", x);
scanf ("%HF", x);
scanf ("%He", x);
scanf ("%Hg", x);
scanf ("%HG", x);
+ scanf ("%Da", y);
+ scanf ("%DA", y);
scanf ("%Df", y);
scanf ("%DF", y);
scanf ("%De", y);
scanf ("%Dg", y);
scanf ("%DG", y);
+ scanf ("%DDa", z);
+ scanf ("%DDA", z);
scanf ("%DDf", z);
scanf ("%DDF", z);
scanf ("%DDe", z);
/* Check warnings for type mismatches. */
+ scanf ("%Ha", y); /* { dg-warning "expects argument" "bad use of %H" } */
+ scanf ("%HA", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hf", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HF", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%He", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HE", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hg", y); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HG", y); /* { dg-warning "expects argument" "bad use of %H" } */
+ scanf ("%Ha", z); /* { dg-warning "expects argument" "bad use of %H" } */
+ scanf ("%HA", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hf", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HF", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%He", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hg", z); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%HG", z); /* { dg-warning "expects argument" "bad use of %H" } */
+ scanf ("%Da", x); /* { dg-warning "expects argument" "bad use of %D" } */
+ scanf ("%DA", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Df", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DF", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%De", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DE", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Dg", x); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DG", x); /* { dg-warning "expects argument" "bad use of %D" } */
+ scanf ("%Da", z); /* { dg-warning "expects argument" "bad use of %D" } */
+ scanf ("%DA", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Df", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DF", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%De", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%Dg", z); /* { dg-warning "expects argument" "bad use of %D" } */
scanf ("%DG", z); /* { dg-warning "expects argument" "bad use of %D" } */
+ scanf ("%DDa", x); /* { dg-warning "expects argument" "bad use of %DD" } */
+ scanf ("%DDA", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDf", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDF", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDe", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDE", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDg", x); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDG", x); /* { dg-warning "expects argument" "bad use of %DD" } */
+ scanf ("%DDa", y); /* { dg-warning "expects argument" "bad use of %DD" } */
+ scanf ("%DDA", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDf", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDF", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%DDe", y); /* { dg-warning "expects argument" "bad use of %DD" } */
scanf ("%Hu\n", j); /* { dg-warning "length" "bad use of %H" } */
scanf ("%Hx\n", j); /* { dg-warning "length" "bad use of %H" } */
scanf ("%HX\n", j); /* { dg-warning "length" "bad use of %H" } */
- scanf ("%Ha\n", d); /* { dg-warning "length" "bad use of %H" } */
- scanf ("%HA\n", d); /* { dg-warning "length" "bad use of %H" } */
+ scanf ("%Ha\n", d); /* { dg-warning "expects argument" "bad use of %H" } */
+ scanf ("%HA\n", d); /* { dg-warning "expects argument" "bad use of %H" } */
scanf ("%Hc\n", i); /* { dg-warning "length" "bad use of %H" } */
scanf ("%Hs\n", p); /* { dg-warning "length" "bad use of %H" } */
scanf ("%Hp\n", p); /* { dg-warning "length" "bad use of %H" } */