+2007-08-13 Dan Hipschman <dsh@google.com>
+
+ PR c/32953
+ * c-format.c (check_format_arg): Move check for zero-length
+ format strings below the check for unterminated strings.
+
2007-08-13 Andrew Pinski <pinskia@gmail.com>
PR C/30427
format_chars += offset;
format_length -= offset;
}
- if (format_length < 1)
+ if (format_length < 1 || format_chars[--format_length] != 0)
{
res->number_unterminated++;
return;
}
- if (format_length == 1)
+ if (format_length == 0)
{
res->number_empty++;
return;
}
- if (format_chars[--format_length] != 0)
- {
- res->number_unterminated++;
- return;
- }
/* Skip to first argument to check. */
while (arg_num + 1 < info->first_arg_num)
+2007-08-13 Dan Hipschman <dsh@google.com>
+
+ PR c/32953
+ * gcc.dg/format/array-1.c: Add an additional test for
+ unterminated format strings of length 1.
+
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/32926
const char a1[] = "foo";
const char a2[] = "foo%d";
-const char b[3] = "foo";
+const char b1[3] = "foo";
+const char b2[1] = "1";
static const char c1[] = "foo";
static const char c2[] = "foo%d";
char d[] = "foo";
printf (a1);
printf (a2, i);
printf (a2, l); /* { dg-warning "format" "wrong type with array" } */
- printf (b); /* { dg-warning "unterminated" "unterminated array" } */
+ printf (b1); /* { dg-warning "unterminated" "unterminated array" } */
+ printf (b2); /* { dg-warning "unterminated" "unterminated array" } */
printf (c1);
printf (c2, i);
printf (c2, l); /* { dg-warning "format" "wrong type with array" } */