+2016-06-12 Brooks Moses <bmoses@google.com>
+
+ * cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length
+ VLAs.
+
2016-05-31 Alan Modra <amodra@gmail.com>
* xmemdup.c (xmemdup): Use xmalloc rather than xcalloc.
{
#ifdef CP_DYNAMIC_ARRAYS
- __extension__ struct d_saved_scope scopes[dpi.num_saved_scopes];
- __extension__ struct d_print_template temps[dpi.num_copy_templates];
+ /* Avoid zero-length VLAs, which are prohibited by the C99 standard
+ and flagged as errors by Address Sanitizer. */
+ __extension__ struct d_saved_scope scopes[(dpi.num_saved_scopes > 0)
+ ? dpi.num_saved_scopes : 1];
+ __extension__ struct d_print_template temps[(dpi.num_copy_templates > 0)
+ ? dpi.num_copy_templates : 1];
dpi.saved_scopes = scopes;
dpi.copy_templates = temps;