c: fix uninitialized c_expr::m_decimal [PR106830]
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 22 Sep 2022 12:35:26 +0000 (08:35 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 22 Sep 2022 12:35:26 +0000 (08:35 -0400)
commit86254629b636db579616befde49022f098af8148
treea4b54ac73c403e0bcacf3e7d9bf9c232da7e005d
parent9baee6181b4e427e0b5ba417e51424c15858dce7
c: fix uninitialized c_expr::m_decimal [PR106830]

I added c_expr::m_decimal in r13-2386-gbedfca647a9e9c1a as part of the
implementation of -Wxor-used-as-pow, but I missed various places where
the field needed to be initialized.

Fixed thusly.

gcc/c-family/ChangeLog:
PR c/106830
* c-warn.cc (check_for_xor_used_as_pow): Don't try checking
values that don't fit in uhwi.

gcc/c/ChangeLog:
PR c/106830
* c-parser.cc (c_parser_initelt): Initialize m_decimal.
(c_parser_cast_expression): Likewise.
(c_parser_alignof_expression): Likewise.
(c_parser_postfix_expression_after_paren_type): Likewise.
(c_parser_postfix_expression_after_primary): Likewise.
(c_parser_expression): Likewise.
(c_parser_omp_variable_list): Likewise.
(c_parser_transaction_expression): Likewise.
* c-tree.h (c_expr::set_error): Likewise.
* c-typeck.cc (c_expr_sizeof_expr): Likewise.
(parser_build_unary_op): Likewise.
(parser_build_binary_op): Likewise.
(digest_init): Likewise.
(pop_init_level): Likewise.
* gimple-parser.cc (c_parser_gimple_call_internal): Likewise.

gcc/testsuite/ChangeLog:
PR c/106830
* gcc.dg/Wxor-used-as-pow-pr106830.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/c-family/c-warn.cc
gcc/c/c-parser.cc
gcc/c/c-tree.h
gcc/c/c-typeck.cc
gcc/c/gimple-parser.cc
gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c [new file with mode: 0644]