public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/99612] Remove "#pragma GCC system_header" from atomic file to warn on incorrect memory order Date: Tue, 16 Mar 2021 16:18:34 +0000 [thread overview] Message-ID: <bug-99612-4-UeXyWe7UyQ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99612-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99612 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- The test case: $ (set -x && cat pr99612.C && g++ -O2 -S -Wall --std=c++20 -O2 -Wall -Winvalid-memory-model pr99612.C && g++ -O2 -S -Wall --std=c++20 -O2 -Wall -Winvalid-memory-model -Wsystem-headers pr99612.C) + cat pr99612.C #include <atomic> std::atomic<int> a; int f() { auto ret = a.load(std::memory_order_release); a.store(10, std::memory_order_acquire); return ret; } + g++ -O2 -S -Wall --std=c++20 -O2 -Wall -Winvalid-memory-model pr99612.C + /g++ -O2 -S -Wall --std=c++20 -O2 -Wall -Winvalid-memory-model -Wsystem-headers pr99612.C In file included from /build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/atomic:41, from pr99612.C:1: /build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/atomic_base.h: In function ‘int f()’: /build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/atomic_base.h:479:31: warning: invalid memory model for ‘__atomic_load’ [-Winvalid-memory-model] 479 | return __atomic_load_n(&_M_i, int(__m)); | ^ /build/gcc-master/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/atomic_base.h:455:25: warning: invalid memory model for ‘__atomic_store’ [-Winvalid-memory-model] 455 | __atomic_store_n(&_M_i, __i, int(__m)); | ^
next prev parent reply other threads:[~2021-03-16 16:18 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-16 8:32 [Bug libstdc++/99612] New: " antoshkka at gmail dot com 2021-03-16 12:17 ` [Bug libstdc++/99612] " redi at gcc dot gnu.org 2021-03-16 16:14 ` [Bug middle-end/99612] " msebor at gcc dot gnu.org 2021-03-16 16:15 ` msebor at gcc dot gnu.org 2021-03-16 16:18 ` msebor at gcc dot gnu.org [this message] 2021-12-08 16:50 ` msebor at gcc dot gnu.org 2022-01-04 20:57 ` cvs-commit at gcc dot gnu.org 2022-01-04 21:00 ` msebor at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-99612-4-UeXyWe7UyQ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).