public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3868] go: don't crash if __atomic_fetch_add functions are used
@ 2022-11-10  0:08 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2022-11-10  0:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:219f82070903625d6bd8865b5ecb5f944bcee871

commit r13-3868-g219f82070903625d6bd8865b5ecb5f944bcee871
Author: Ian Lance Taylor <iant@golang.org>
Date:   Wed Nov 9 16:05:08 2022 -0800

    go: don't crash if __atomic_fetch_add functions are used
    
    The Go frontend only generates __atomic_add_fetch, but in some cases
    thost calls become __atomic_fetch_add.
    
    Patch originally by Marc Poulhiès.
    
            PR target/107581
            * go-gcc.cc (Gcc_backend::Gcc_backend): Define
            __atomic_fetch_add_{4,8}.

Diff:
---
 gcc/go/go-gcc.cc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 1ba7206caeb..6e5887aecab 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -886,16 +886,20 @@ Gcc_backend::Gcc_backend()
                                uint32_type_node,
                                integer_type_node,
                                NULL_TREE);
-  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4", NULL,
-                       t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4",
+		       NULL, t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_4, "__atomic_fetch_add_4",
+		       NULL, t, 0);
 
   t = build_function_type_list(uint64_type_node,
                                ptr_type_node,
                                uint64_type_node,
                                integer_type_node,
                                NULL_TREE);
-  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8", NULL,
-                       t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8",
+		       NULL, t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_8, "__atomic_fetch_add_8",
+		       NULL, t, 0);
 
   t = build_function_type_list(unsigned_char_type_node,
 			       ptr_type_node,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-10  0:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  0:08 [gcc r13-3868] go: don't crash if __atomic_fetch_add functions are used Ian Lance Taylor

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).