aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-tree.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2022-09-22 08:35:26 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2022-09-22 08:35:26 -0400
commit86254629b636db579616befde49022f098af8148 (patch)
treea4b54ac73c403e0bcacf3e7d9bf9c232da7e005d /gcc/c/c-tree.h
parent9baee6181b4e427e0b5ba417e51424c15858dce7 (diff)
downloadgcc-86254629b636db579616befde49022f098af8148.zip
gcc-86254629b636db579616befde49022f098af8148.tar.gz
gcc-86254629b636db579616befde49022f098af8148.tar.bz2
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>
Diffstat (limited to 'gcc/c/c-tree.h')
-rw-r--r--gcc/c/c-tree.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index b4231a1..46a3e8e 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -164,12 +164,13 @@ struct c_expr
}
/* Set the value to error_mark_node whilst ensuring that src_range
- is initialized. */
+ and m_decimal are initialized. */
void set_error ()
{
value = error_mark_node;
src_range.m_start = UNKNOWN_LOCATION;
src_range.m_finish = UNKNOWN_LOCATION;
+ m_decimal = 0;
}
};