Fix uninitialized src_range values for c_expr
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 17 Nov 2015 20:09:56 +0000 (20:09 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 17 Nov 2015 20:09:56 +0000 (20:09 +0000)
commitbef08b718f9cacd17fb74fab77b125d2c92b7493
tree5ac459668109c02d425e211e6d65ca804b65d25e
parent5f0b7c95485eb8e6e663d7fd8df5243192a3c7df
Fix uninitialized src_range values for c_expr

gcc/c/ChangeLog:
* c-parser.c (set_c_expr_source_range): Bulletproof both
overloaded implementations against NULL expr->value.
(c_parser_braced_init): Set src_range for "ret" to a sane pair of
values.
(c_parser_unary_expression): Likewise when handling addresses of
labels.
(c_parser_postfix_expression): Likewise for statement expressions,
for __FUNCTION__, __PRETTY_FUNCTION_ and __func__ keywords, for
__builtin_va_arg, and for __builtin_offset_of.
(c_parser_postfix_expression_after_paren_type): Initialize expr's
src_range using the range of the braced initializer.
(c_parser_transaction_expression): Set src_range for "ret" to a
sane pair of values.

gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-expressions-1.c (vector): New
macro.
(test_braced_init): New function.
(test_statement_expression): New function.
(test_address_of_label): New function.
(test_transaction_expressions): New function.
(test_keywords): New function.
(test_builtin_va_arg): New function.
(test_builtin_offsetof): New function.
* lib/multiline.exp (_build_multiline_regex): Escape braces.

From-SVN: r230497
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c
gcc/testsuite/lib/multiline.exp