gcc/analyzer/ChangeLog:
PR analyzer/110882
* region.cc (int_size_in_bits): Fail on zero-sized types.
gcc/testsuite/ChangeLog:
PR analyzer/110882
* gcc.dg/analyzer/pr110882.c: New test.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
}
tree sz = TYPE_SIZE (type);
- if (sz && tree_fits_uhwi_p (sz))
+ if (sz
+ && tree_fits_uhwi_p (sz)
+ /* If the size is zero, then we may have a zero-sized
+ array; handle such cases by returning false. */
+ && !integer_zerop (sz))
{
*out = TREE_INT_CST_LOW (sz);
return true;
--- /dev/null
+/* { dg-additional-options "-Wno-analyzer-too-complex" } */
+
+struct csv_row {
+ char *columns[0];
+};
+
+void
+parse_csv_line (int n_columns, const char *columns[])
+{
+ for (int n = 0; n < n_columns; n++) {
+ columns[n] = ((void *)0);
+ }
+}
+
+void parse_csv_data (int n_columns, struct csv_row *entry)
+{
+ parse_csv_line(n_columns, (const char **)entry->columns);
+}