+2000-10-18 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * c-common.c (check_format_types): Check for writing through a
+ NULL pointer argument.
+
2000-10-18 Hans-Peter Nilsson <hp@axis.com>
* tm.texi (Exception Region Output): Document
if (TREE_CODE (cur_type) == ERROR_MARK)
break;
+ /* Check for writing through a NULL pointer. */
+ if (types->writing_in_flag
+ && i == 0
+ && cur_param != 0
+ && integer_zerop (cur_param))
+ status_warning (status,
+ "writing through null pointer (arg %d)",
+ arg_num);
+
if (cur_param != 0 && TREE_CODE (cur_param) == ADDR_EXPR)
cur_param = TREE_OPERAND (cur_param, 0);
else
+2000-10-18 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * gcc.dg/c90-printf-1.c, gcc.dg/c90-scanf-1.c: Add tests for
+ writing through null pointers; remove comment about testing
+ unterminated strings.
+
2000-10-17 Matthew Hiller <hiller@redhat.com>
* gcc.c-torture/execute/20001017-2.c: New test.
printf ("%++d", i); /* { dg-warning "repeated" "repeated flag warning" } */
printf ("%n", cn); /* { dg-warning "constant" "%n with const" } */
printf ((const char *)L"foo"); /* { dg-warning "wide" "wide string" } */
- /* Can we test for the warning for unterminated string formats? */
+ printf ("%n", (int *)0); /* { dg-warning "null" "%n with NULL" } */
}
scanf ("%d\0%d", ip, ip); /* { dg-warning "embedded|too many" "warning for embedded NUL" } */
scanf (NULL); /* { dg-warning "null" "null format string warning" } */
scanf ("%"); /* { dg-warning "trailing" "trailing % warning" } */
+ scanf ("%d", (int *)0); /* { dg-warning "null" "writing into NULL" } */
}