[Bug middle-end/99612] Remove "#pragma GCC system_header" from atomic file to warn on incorrect memory order
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 4 20:57:56 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99612
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:
https://gcc.gnu.org/g:5a431b60d1f221992e5e9f7a5c032df3b5fa35a5
commit r12-6216-g5a431b60d1f221992e5e9f7a5c032df3b5fa35a5
Author: Martin Sebor <msebor@redhat.com>
Date: Tue Jan 4 13:44:23 2022 -0700
Eenable -Winvalid-memory-order for C++ [PR99612].
Resolves:
PR middle-end/99612 - Remove "#pragma GCC system_header" from atomic file
to warn on incorrect memory order
gcc/ChangeLog:
PR middle-end/99612
* builtins.c (get_memmodel): Move warning code to
gimple-ssa-warn-access.cc.
(expand_builtin_atomic_compare_exchange): Same.
(expand_ifn_atomic_compare_exchange): Same.
(expand_builtin_atomic_load): Same.
(expand_builtin_atomic_store): Same.
(expand_builtin_atomic_clear): Same.
* doc/extend.texi (__atomic_exchange_n): Update valid memory
models.
* gimple-ssa-warn-access.cc (memmodel_to_uhwi): New function.
(struct memmodel_pair): New struct.
(memmodel_name): New function.
(pass_waccess::maybe_warn_memmodel): New function.
(pass_waccess::check_atomic_memmodel): New function.
(pass_waccess::check_atomic_builtin): Handle memory model.
* input.c (expansion_point_location_if_in_system_header): Return
original location if expansion location is in a system header.
gcc/testsuite/ChangeLog:
PR middle-end/99612
* c-c++-common/pr83059.c: Adjust text of expected diagnostics.
* gcc.dg/atomic-invalid-2.c: Same.
* gcc.dg/atomic-invalid.c: Same.
* c-c++-common/Winvalid-memory-model.c: New test.
* g++.dg/warn/Winvalid-memory-model-2.C: New test.
* g++.dg/warn/Winvalid-memory-model.C: New test.
More information about the Gcc-bugs
mailing list