diff options
author | David Malcolm <dmalcolm@redhat.com> | 2022-09-22 08:35:26 -0400 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2022-09-22 08:35:26 -0400 |
commit | 86254629b636db579616befde49022f098af8148 (patch) | |
tree | a4b54ac73c403e0bcacf3e7d9bf9c232da7e005d /gcc/testsuite | |
parent | 9baee6181b4e427e0b5ba417e51424c15858dce7 (diff) | |
download | gcc-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/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c b/gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c new file mode 100644 index 0000000..104897a --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wxor-used-as-pow-pr106830.c @@ -0,0 +1,6 @@ +/* { dg-require-effective-target int128 } + { dg-options "-Wno-pedantic" } */ + +void foo0_u16_0() { + (__int128)(18302628885633695743 << 4) ^ 0; /* { dg-warning "integer constant is so large that it is unsigned" } */ +} |