c-attribs.c: Fix warning about use of uninitialized variable nunits
In function handle_vector_size_attribute local variable nunits is
supposed to be initialized by function type_valid_for_vector_size.
However, in case ARGS is null the function may return with a non-null
value and leave nunits uninitialized. This results in warning/error:
gcc/poly-int.h: In function 'tree_node* handle_vector_size_attribute(tree_node**, tree, tree, int, bool*)':
gcc/poly-int.h:330:3: error: 'nunits' may be used uninitialized in this function [-Werror=maybe-uninitialized]
330 | ((void) (&(RES).coeffs[0] == (C *) 0), \
| ^
gcc/c-family/c-attribs.c:3695:26: note: 'nunits' was declared here
3695 | unsigned HOST_WIDE_INT nunits;
|
Added attribute nonnull for argument args in order to silence warning
and added an assert statement in order to check the invariant candidate.
gcc/c-family/ChangeLog:
2020-05-05 Stefan Schulze Frielinghaus <stefansf@linux.ibm.com>
* c-attribs.c (handle_vector_size_attribute): Add attribute
nonnull for argument args in order to silence warning of
uninitialized variable usage. Since this is local to the
compilation unit and thus cannot be checked at call sides by the
compiler, added an assert statement in order to verify this.