diff options
author | Martin Liska <mliska@suse.cz> | 2022-08-16 13:28:03 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-08-16 13:28:03 +0200 |
commit | a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d (patch) | |
tree | 237de985e6105a8d1278019437f9269a77f4442f | |
parent | 091222fb0aaa09dcf90f2bc747f1d8a6a8ef1575 (diff) | |
parent | 6e790ca4615443fa395ac5cdba1ab6c87810985c (diff) | |
download | gcc-a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d.zip gcc-a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d.tar.gz gcc-a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d.tar.bz2 |
Merge branch 'master' into devel/sphinx
-rw-r--r-- | gcc/analyzer/region-model.cc | 4 | ||||
-rw-r--r-- | gcc/analyzer/region.h | 3 | ||||
-rw-r--r-- | gcc/config/i386/i386-features.h | 4 | ||||
-rw-r--r-- | gcc/cp/expr.cc | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.cc | 8 | ||||
-rw-r--r-- | gcc/d/gdc.texi | 16 | ||||
-rw-r--r-- | gcc/gimple-range-path.cc | 79 | ||||
-rw-r--r-- | gcc/gimple-range-path.h | 19 | ||||
-rw-r--r-- | gcc/match.pd | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/volatile1.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/volatile3.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/volatile5.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr106630.c | 13 | ||||
-rw-r--r-- | gcc/value-range-equiv.h | 7 | ||||
-rw-r--r-- | gcc/value-range-storage.h | 4 | ||||
-rw-r--r-- | gcc/value-range.h | 1 |
16 files changed, 117 insertions, 77 deletions
diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index b05b709..b5bc3efd 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -3425,7 +3425,7 @@ public: result_set.add (sval); } - void visit_unaryop_svalue (const unaryop_svalue *sval) + void visit_unaryop_svalue (const unaryop_svalue *sval) final override { const svalue *arg = sval->get_arg (); if (result_set.contains (arg)) @@ -3449,7 +3449,7 @@ public: } } - void visit_repeated_svalue (const repeated_svalue *sval) + void visit_repeated_svalue (const repeated_svalue *sval) final override { sval->get_inner_svalue ()->accept (this); if (result_set.contains (sval->get_inner_svalue ())) diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h index 20dffc7..d37584b 100644 --- a/gcc/analyzer/region.h +++ b/gcc/analyzer/region.h @@ -919,7 +919,8 @@ public: const svalue *get_byte_offset () const { return m_byte_offset; } bool get_relative_concrete_offset (bit_offset_t *out) const final override; - const svalue * get_byte_size_sval (region_model_manager *mgr) const; + const svalue * get_byte_size_sval (region_model_manager *mgr) + const final override; private: diff --git a/gcc/config/i386/i386-features.h b/gcc/config/i386/i386-features.h index 3d88a88..f898e67 100644 --- a/gcc/config/i386/i386-features.h +++ b/gcc/config/i386/i386-features.h @@ -183,7 +183,7 @@ class general_scalar_chain : public scalar_chain private: void convert_insn (rtx_insn *insn) final override; - void convert_op (rtx *op, rtx_insn *insn); + void convert_op (rtx *op, rtx_insn *insn) final override; int vector_const_cost (rtx exp); }; @@ -196,7 +196,7 @@ class timode_scalar_chain : public scalar_chain private: void fix_debug_reg_uses (rtx reg); void convert_insn (rtx_insn *insn) final override; - void convert_op (rtx *op, rtx_insn *insn); + void convert_op (rtx *op, rtx_insn *insn) final override; }; } // anon namespace diff --git a/gcc/cp/expr.cc b/gcc/cp/expr.cc index 56fc11f..f3e155b 100644 --- a/gcc/cp/expr.cc +++ b/gcc/cp/expr.cc @@ -220,7 +220,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p, case MODIFY_EXPR: { tree lhs = TREE_OPERAND (expr, 0); - /* [expr.ass] "A simple assignment whose left operand is of + /* [expr.ass] "An assignment whose left operand is of a volatile-qualified type is deprecated unless the assignment is either a discarded-value expression or appears in an unevaluated context." */ @@ -230,7 +230,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p, && !TREE_THIS_VOLATILE (expr)) { if (warning_at (location_of (expr), OPT_Wvolatile, - "using value of simple assignment with " + "using value of assignment with " "%<volatile%>-qualified left operand is " "deprecated")) /* Make sure not to warn about this assignment again. */ diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 15548e5..6b38c8c 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, /* An expression of the form E1 op= E2. [expr.ass] says: "Such expressions are deprecated if E1 has volatile-qualified - type." We warn here rather than in cp_genericize_r because + type and op is not one of the bitwise operators |, &, ^." + We warn here rather than in cp_genericize_r because for compound assignments we are supposed to warn even if the assignment is a discarded-value expression. */ - if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)) + if (modifycode != BIT_AND_EXPR + && modifycode != BIT_IOR_EXPR + && modifycode != BIT_XOR_EXPR + && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))) warning_at (loc, OPT_Wvolatile, "compound assignment with %<volatile%>-qualified left " "operand is deprecated"); diff --git a/gcc/d/gdc.texi b/gcc/d/gdc.texi index fc76c13..641f97d 100644 --- a/gcc/d/gdc.texi +++ b/gcc/d/gdc.texi @@ -295,14 +295,17 @@ values are supported: @item all Turns on all upcoming D language features. @item dip1000 -Implements @uref{https://wiki.dlang.org/DIP1000} (Scoped pointers). +Implements @uref{https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1000.md} +(Scoped pointers). @item dip1008 -Implements @uref{https://wiki.dlang.org/DIP1008} (Allow exceptions in -@code{@@nogc} code). +Implements @uref{https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1008.md} +(Allow exceptions in @code{@@nogc} code). @item dip1021 -Implements @uref{https://wiki.dlang.org/DIP1021} (Mutable function arguments). +Implements @uref{https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1021.md} +(Mutable function arguments). @item dip25 -Implements @uref{https://wiki.dlang.org/DIP25} (Sealed references). +Implements @uref{https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md} +(Sealed references). @item dtorfields Turns on generation for destructing fields of partially constructed objects. @item fieldwise @@ -352,7 +355,8 @@ are supported: @item all Turns off all revertable D language features. @item dip25 -Reverts @uref{https://wiki.dlang.org/DIP25} (Sealed references). +Reverts @uref{https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md} +(Sealed references). @item dtorfields Turns off generation for destructing fields of partially constructed objects. @item markdown diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc index 78146f5..c99d77d 100644 --- a/gcc/gimple-range-path.cc +++ b/gcc/gimple-range-path.cc @@ -62,13 +62,13 @@ path_range_query::~path_range_query () delete m_cache; } -// Return TRUE if NAME is in the import bitmap. +// Return TRUE if NAME is an exit depenency for the path. bool -path_range_query::import_p (tree name) +path_range_query::exit_dependency_p (tree name) { return (TREE_CODE (name) == SSA_NAME - && bitmap_bit_p (m_imports, SSA_NAME_VERSION (name))); + && bitmap_bit_p (m_exit_dependencies, SSA_NAME_VERSION (name))); } // Mark cache entry for NAME as unused. @@ -118,8 +118,8 @@ path_range_query::dump (FILE *dump_file) dump_ranger (dump_file, m_path); - fprintf (dump_file, "Imports:\n"); - EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi) + fprintf (dump_file, "Exit dependencies:\n"); + EXECUTE_IF_SET_IN_BITMAP (m_exit_dependencies, 0, i, bi) { tree name = ssa_name (i); print_generic_expr (dump_file, name, TDF_SLIM); @@ -356,7 +356,7 @@ path_range_query::compute_ranges_in_phis (basic_block bb) gphi *phi = iter.phi (); tree name = gimple_phi_result (phi); - if (!import_p (name)) + if (!exit_dependency_p (name)) continue; Value_Range r (TREE_TYPE (name)); @@ -400,17 +400,17 @@ path_range_query::compute_ranges_in_block (basic_block bb) // Force recalculation of any names in the cache that are defined in // this block. This can happen on interdependent SSA/phis in loops. - EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi) + EXECUTE_IF_SET_IN_BITMAP (m_exit_dependencies, 0, i, bi) { tree name = ssa_name (i); if (ssa_defined_in_bb (name, bb)) clear_cache (name); } - // Solve imports defined in this block, starting with the PHIs... + // Solve dependencies defined in this block, starting with the PHIs... compute_ranges_in_phis (bb); - // ...and then the rest of the imports. - EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi) + // ...and then the rest of the dependencies. + EXECUTE_IF_SET_IN_BITMAP (m_exit_dependencies, 0, i, bi) { tree name = ssa_name (i); Value_Range r (TREE_TYPE (name)); @@ -423,7 +423,7 @@ path_range_query::compute_ranges_in_block (basic_block bb) if (at_exit ()) return; - // Solve imports that are exported to the next block. + // Solve dependencies that are exported to the next block. basic_block next = next_bb (); edge e = find_edge (bb, next); @@ -444,7 +444,7 @@ path_range_query::compute_ranges_in_block (basic_block bb) gori_compute &g = m_ranger->gori (); bitmap exports = g.exports (bb); - EXECUTE_IF_AND_IN_BITMAP (m_imports, exports, 0, i, bi) + EXECUTE_IF_AND_IN_BITMAP (m_exit_dependencies, exports, 0, i, bi) { tree name = ssa_name (i); Value_Range r (TREE_TYPE (name)); @@ -472,7 +472,7 @@ path_range_query::compute_ranges_in_block (basic_block bb) compute_outgoing_relations (bb, next); } -// Adjust all pointer imports in BB with non-null information. +// Adjust all pointer exit dependencies in BB with non-null information. void path_range_query::adjust_for_non_null_uses (basic_block bb) @@ -481,7 +481,7 @@ path_range_query::adjust_for_non_null_uses (basic_block bb) bitmap_iterator bi; unsigned i; - EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi) + EXECUTE_IF_SET_IN_BITMAP (m_exit_dependencies, 0, i, bi) { tree name = ssa_name (i); @@ -501,39 +501,33 @@ path_range_query::adjust_for_non_null_uses (basic_block bb) } } -// If NAME is a supported SSA_NAME, add it the bitmap in IMPORTS. +// If NAME is a supported SSA_NAME, add it to the bitmap in dependencies. bool -path_range_query::add_to_imports (tree name, bitmap imports) +path_range_query::add_to_exit_dependencies (tree name, bitmap dependencies) { if (TREE_CODE (name) == SSA_NAME && Value_Range::supports_type_p (TREE_TYPE (name))) - return bitmap_set_bit (imports, SSA_NAME_VERSION (name)); + return bitmap_set_bit (dependencies, SSA_NAME_VERSION (name)); return false; } -// Compute the imports to PATH. These are -// essentially the SSA names used to calculate the final conditional -// along the path. -// -// They are hints for the solver. Adding more elements doesn't slow -// us down, because we don't solve anything that doesn't appear in the -// path. On the other hand, not having enough imports will limit what -// we can solve. +// Compute the exit dependencies to PATH. These are essentially the +// SSA names used to calculate the final conditional along the path. void -path_range_query::compute_imports (bitmap imports, const vec<basic_block> &path) +path_range_query::compute_exit_dependencies (bitmap dependencies, + const vec<basic_block> &path) { // Start with the imports from the exit block... basic_block exit = path[0]; gori_compute &gori = m_ranger->gori (); - bitmap r_imports = gori.imports (exit); - bitmap_copy (imports, r_imports); + bitmap_copy (dependencies, gori.imports (exit)); - auto_vec<tree> worklist (bitmap_count_bits (imports)); + auto_vec<tree> worklist (bitmap_count_bits (dependencies)); bitmap_iterator bi; unsigned i; - EXECUTE_IF_SET_IN_BITMAP (imports, 0, i, bi) + EXECUTE_IF_SET_IN_BITMAP (dependencies, 0, i, bi) { tree name = ssa_name (i); worklist.quick_push (name); @@ -557,7 +551,7 @@ path_range_query::compute_imports (bitmap imports, const vec<basic_block> &path) if (TREE_CODE (arg) == SSA_NAME && path.contains (e->src) - && bitmap_set_bit (imports, SSA_NAME_VERSION (arg))) + && bitmap_set_bit (dependencies, SSA_NAME_VERSION (arg))) worklist.safe_push (arg); } } @@ -581,7 +575,7 @@ path_range_query::compute_imports (bitmap imports, const vec<basic_block> &path) for (unsigned j = 0; j < 3; ++j) { tree rhs = ssa[j]; - if (rhs && add_to_imports (rhs, imports)) + if (rhs && add_to_exit_dependencies (rhs, dependencies)) worklist.safe_push (rhs); } } @@ -594,19 +588,20 @@ path_range_query::compute_imports (bitmap imports, const vec<basic_block> &path) tree name; FOR_EACH_GORI_EXPORT_NAME (gori, bb, name) if (TREE_CODE (TREE_TYPE (name)) == BOOLEAN_TYPE) - bitmap_set_bit (imports, SSA_NAME_VERSION (name)); + bitmap_set_bit (dependencies, SSA_NAME_VERSION (name)); } } -// Compute the ranges for IMPORTS along PATH. +// Compute the ranges for DEPENDENCIES along PATH. // -// IMPORTS are the set of SSA names, any of which could potentially -// change the value of the final conditional in PATH. Default to the -// imports of the last block in the path if none is given. +// DEPENDENCIES are path exit dependencies. They are the set of SSA +// names, any of which could potentially change the value of the final +// conditional in PATH. If none is given, the exit dependencies are +// calculated from the final conditional in the path. void path_range_query::compute_ranges (const vec<basic_block> &path, - const bitmap_head *imports) + const bitmap_head *dependencies) { if (DEBUG_SOLVER) fprintf (dump_file, "\n==============================================\n"); @@ -614,10 +609,10 @@ path_range_query::compute_ranges (const vec<basic_block> &path, set_path (path); m_undefined_path = false; - if (imports) - bitmap_copy (m_imports, imports); + if (dependencies) + bitmap_copy (m_exit_dependencies, dependencies); else - compute_imports (m_imports, m_path); + compute_exit_dependencies (m_exit_dependencies, m_path); if (m_resolve) get_path_oracle ()->reset_path (); @@ -809,7 +804,7 @@ path_range_query::compute_phi_relations (basic_block bb, basic_block prev) tree result = gimple_phi_result (phi); unsigned nargs = gimple_phi_num_args (phi); - if (!import_p (result)) + if (!exit_dependency_p (result)) continue; for (size_t i = 0; i < nargs; ++i) diff --git a/gcc/gimple-range-path.h b/gcc/gimple-range-path.h index e783e00..3cb794e 100644 --- a/gcc/gimple-range-path.h +++ b/gcc/gimple-range-path.h @@ -35,9 +35,10 @@ public: path_range_query (bool resolve = true, class gimple_ranger *ranger = NULL); virtual ~path_range_query (); void compute_ranges (const vec<basic_block> &, - const bitmap_head *imports = NULL); + const bitmap_head *dependencies = NULL); void compute_ranges (edge e); - void compute_imports (bitmap imports, const vec<basic_block> &); + void compute_exit_dependencies (bitmap dependencies, + const vec<basic_block> &); bool range_of_expr (vrange &r, tree name, gimple * = NULL) override; bool range_of_stmt (vrange &r, gimple *, tree name = NULL) override; bool unreachable_path_p (); @@ -64,8 +65,8 @@ private: void compute_outgoing_relations (basic_block bb, basic_block next); void compute_phi_relations (basic_block bb, basic_block prev); void maybe_register_phi_relation (gphi *, edge e); - bool add_to_imports (tree name, bitmap imports); - bool import_p (tree name); + bool add_to_exit_dependencies (tree name, bitmap dependencies); + bool exit_dependency_p (tree name); bool ssa_defined_in_bb (tree name, basic_block bb); bool relations_may_be_invalidated (edge); @@ -89,7 +90,15 @@ private: // Path being analyzed. auto_vec<basic_block> m_path; - auto_bitmap m_imports; + // This is a list of SSA names that may have relevant context + // information for solving the final conditional along the path. + // Ranges for these SSA names are pre-calculated and cached during a + // top-down traversal of the path, and are then used to answer + // questions at the path exit. + auto_bitmap m_exit_dependencies; + + // A ranger used to resolve ranges for SSA names whose values come + // from outside the path. gimple_ranger *m_ranger; // Current path position. diff --git a/gcc/match.pd b/gcc/match.pd index e32bda6..07d0a61 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1917,7 +1917,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (convert (mult@0 zero_one_valued_p@1 INTEGER_CST@2)) (if (INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (@0)) - && TYPE_PRECISION (type) <= TYPE_PRECISION (TREE_TYPE (@0))) + && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (@0))) (mult (convert @1) (convert @2)))) /* (X << C) != 0 can be simplified to X, when C is zero_one_valued_p. diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile1.C b/gcc/testsuite/g++.dg/cpp2a/volatile1.C index 7ea6b47..a0264a4 100644 --- a/gcc/testsuite/g++.dg/cpp2a/volatile1.C +++ b/gcc/testsuite/g++.dg/cpp2a/volatile1.C @@ -56,6 +56,9 @@ fn2 () vi = i; vi = i = 42; i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } + i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } + i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } + i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } (vi = 42, 45); (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } @@ -74,8 +77,9 @@ fn2 () vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } + vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } + vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } + vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } @@ -131,7 +135,8 @@ void raccoon () volatile T t, u; t = 42; u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } - t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } + t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" "" { target c++20 } } + t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } } void diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile3.C b/gcc/testsuite/g++.dg/cpp2a/volatile3.C index f10a297..58816dc 100644 --- a/gcc/testsuite/g++.dg/cpp2a/volatile3.C +++ b/gcc/testsuite/g++.dg/cpp2a/volatile3.C @@ -57,6 +57,9 @@ fn2 () vi = i; vi = i = 42; i = vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } + i = vi |= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" } + i = vi &= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" } + i = vi ^= 42; // { dg-warning "using value of assignment with .volatile.-qualified left operand is deprecated" } &(vi = i); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } (vi = 42, 45); (i = vi = 42, 10); // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } @@ -75,8 +78,9 @@ fn2 () vi += i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } vi -= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } vi %= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - vi ^= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - vi |= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } + vi ^= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } + vi |= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } + vi &= i; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } vi /= i; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } vi = vi += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } vi += vi = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } @@ -132,7 +136,8 @@ void raccoon () volatile T t, u; t = 42; u = t = 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } - t &= 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } + t += 42; // { dg-warning "assignment with .volatile.-qualified left operand is deprecated" } + t &= 42; // { dg-bogus "assignment with .volatile.-qualified left operand is deprecated" } } void diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile5.C b/gcc/testsuite/g++.dg/cpp2a/volatile5.C index 1f9d238..3684be9 100644 --- a/gcc/testsuite/g++.dg/cpp2a/volatile5.C +++ b/gcc/testsuite/g++.dg/cpp2a/volatile5.C @@ -8,8 +8,8 @@ f (bool b) { (b ? x : y) = 1; (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } } - z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } - ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } - (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } - (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + z = (b ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } + ((z = 2) ? x : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } + (b ? (x = 2) : y) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } + (b ? x : (y = 5)) = 1; // { dg-warning "using value of assignment" "" { target c++20 } } } diff --git a/gcc/testsuite/gcc.dg/torture/pr106630.c b/gcc/testsuite/gcc.dg/torture/pr106630.c new file mode 100644 index 0000000..d608b91 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr106630.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +short d, e; +int f; +extern short g[][24]; +char c; +void h() { + char a = 6; + c = a; + for (unsigned long a = (d || e) - 1; a < c; a += f) + for (signed b = 0; b < 24; b++) + g[a][b] = 4; +} diff --git a/gcc/value-range-equiv.h b/gcc/value-range-equiv.h index 0a52d13..1a8014d 100644 --- a/gcc/value-range-equiv.h +++ b/gcc/value-range-equiv.h @@ -37,6 +37,9 @@ class GTY((user)) value_range_equiv : public value_range /* Shallow-copies equiv bitmap. */ value_range_equiv& operator=(const value_range_equiv &) /* = delete */; + /* Virtual destructor. */ + virtual ~value_range_equiv () = default; + /* Move equiv bitmap from source range. */ void move (value_range_equiv *); @@ -54,8 +57,8 @@ class GTY((user)) value_range_equiv : public value_range bool equal_p (const value_range_equiv &, bool ignore_equivs) const; /* Types of value ranges. */ - void set_undefined (); - void set_varying (tree); + void set_undefined () override; + void set_varying (tree) override; /* Equivalence bitmap methods. */ bitmap equiv () const { return m_equiv; } diff --git a/gcc/value-range-storage.h b/gcc/value-range-storage.h index 3fac5ea..9cd6b9f 100644 --- a/gcc/value-range-storage.h +++ b/gcc/value-range-storage.h @@ -119,7 +119,7 @@ class GTY (()) frange_storage_slot frange_props m_props; }; -class obstack_vrange_allocator : public vrange_allocator +class obstack_vrange_allocator final: public vrange_allocator { public: obstack_vrange_allocator () @@ -139,7 +139,7 @@ private: obstack m_obstack; }; -class ggc_vrange_allocator : public vrange_allocator +class ggc_vrange_allocator final: public vrange_allocator { public: ggc_vrange_allocator () { } diff --git a/gcc/value-range.h b/gcc/value-range.h index 856947d..f0075d0 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -228,6 +228,7 @@ public: int_range (tree type); int_range (const int_range &); int_range (const irange &); + virtual ~int_range () = default; int_range& operator= (const int_range &); private: template <unsigned X> friend void gt_ggc_mx (int_range<X> *); |