-
- Downloads
PR c++/80560 - warn on undefined memory operations involving non-trivial types
gcc/c-family/ChangeLog: PR c++/80560 * c.opt (-Wclass-memaccess): New option. gcc/cp/ChangeLog: PR c++/80560 * call.c (first_non_public_field, maybe_warn_class_memaccess): New functions. (has_trivial_copy_assign_p, has_trivial_copy_p): Ditto. (build_cxx_call): Call maybe_warn_class_memaccess. gcc/ChangeLog: PR c++/80560 * dumpfile.c (dump_register): Avoid calling memset to initialize a class with a default ctor. * gcc.c (struct compiler): Remove const qualification. * genattrtab.c (gen_insn_reserv): Replace memset with initialization. * hash-table.h: Ditto. * ipa-cp.c (allocate_and_init_ipcp_value): Replace memset with assignment. * ipa-prop.c (ipa_free_edge_args_substructures): Ditto. * omp-low.c (lower_omp_ordered_clauses): Replace memset with default ctor. * params.h (struct param_info): Make struct members non-const. * tree-switch-conversion.c (emit_case_bit_tests): Replace memset with default initialization. * vec.h (vec_copy_construct, vec_default_construct): New helper functions. (vec<T>::copy, vec<T>::splice, vec<T>::reserve): Replace memcpy with vec_copy_construct. (vect<T>::quick_grow_cleared): Replace memset with default ctor. (vect<T>::vec_safe_grow_cleared, vec_safe_grow_cleared): Same. * doc/invoke.texi (-Wclass-memaccess): Document. libcpp/ChangeLog: PR c++/80560 * line-map.c (line_maps::~line_maps): Avoid calling htab_delete with a null pointer. (linemap_init): Avoid calling memset on an object of a non-trivial type. libitm/ChangeLog: PR c++/80560 * beginend.cc (GTM::gtm_thread::rollback): Avoid calling memset on an object of a non-trivial type. (GTM::gtm_transaction_cp::commit): Use assignment instead of memcpy to copy an object. * method-ml.cc (orec_iterator::reinit): Avoid -Wclass-memaccess. gcc/testsuite/ChangeLog: PR c++/80560 * g++.dg/Wclass-memaccess.C: New test. From-SVN: r249234
Showing
- gcc/ChangeLog 24 additions, 0 deletionsgcc/ChangeLog
- gcc/c-family/ChangeLog 5 additions, 0 deletionsgcc/c-family/ChangeLog
- gcc/c-family/c.opt 4 additions, 0 deletionsgcc/c-family/c.opt
- gcc/cp/ChangeLog 8 additions, 0 deletionsgcc/cp/ChangeLog
- gcc/cp/call.c 391 additions, 0 deletionsgcc/cp/call.c
- gcc/doc/invoke.texi 19 additions, 1 deletiongcc/doc/invoke.texi
- gcc/dumpfile.c 8 additions, 1 deletiongcc/dumpfile.c
- gcc/gcc.c 2 additions, 2 deletionsgcc/gcc.c
- gcc/genattrtab.c 2 additions, 2 deletionsgcc/genattrtab.c
- gcc/hash-table.h 4 additions, 1 deletiongcc/hash-table.h
- gcc/ipa-cp.c 3 additions, 4 deletionsgcc/ipa-cp.c
- gcc/ipa-prop.c 1 addition, 1 deletiongcc/ipa-prop.c
- gcc/omp-low.c 5 additions, 1 deletiongcc/omp-low.c
- gcc/params.h 2 additions, 2 deletionsgcc/params.h
- gcc/testsuite/ChangeLog 5 additions, 0 deletionsgcc/testsuite/ChangeLog
- gcc/testsuite/g++.dg/Wclass-memaccess.C 1671 additions, 0 deletionsgcc/testsuite/g++.dg/Wclass-memaccess.C
- gcc/tree-switch-conversion.c 1 addition, 3 deletionsgcc/tree-switch-conversion.c
- gcc/vec.h 30 additions, 11 deletionsgcc/vec.h
- libcpp/line-map.c 3 additions, 2 deletionslibcpp/line-map.c
- libitm/beginend.cc 3 additions, 3 deletionslibitm/beginend.cc
Loading
Please register or sign in to comment