https://gcc.gnu.org/g:9c95fc59d116f29da69793c64270f2877980609e

commit r17-5489-g9c95fc59d116f29da69793c64270f2877980609e
Author: Nathan Sidwell <[email protected]>
Date:   Tue Oct 20 09:11:52 2026 -0400

    [C++] Fix duplicate-decls flag clearing
    
    The C++ FE was not merging NO_VOPS when faced with an explicit
    declaration of a built-in that had that flag set (for instance). Thus
    clearing the flag and leading to undesired behavior. This merges that
    and a couple of other flags that the C FE is already handling
    correctly.
    
            gcc/cp/
            * decl.cc (merge_attribute_bits): Propagate DECL_NO_LIMIT_STACK,
            DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_IS_NOVOPS.

Diff:
---
 gcc/cp/decl.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 593e67fd03b3..16ce7cd36b0a 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -1705,6 +1705,14 @@ merge_attribute_bits (tree newdecl, tree olddecl)
   TREE_DEPRECATED (olddecl) |= TREE_DEPRECATED (newdecl);
   TREE_UNAVAILABLE (newdecl) |= TREE_UNAVAILABLE (olddecl);
   TREE_UNAVAILABLE (olddecl) |= TREE_UNAVAILABLE (newdecl);
+  DECL_NO_LIMIT_STACK (newdecl) |= DECL_NO_LIMIT_STACK (olddecl);
+  DECL_NO_LIMIT_STACK (olddecl) |= DECL_NO_LIMIT_STACK (newdecl);
+  DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl)
+    |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl);
+  DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (olddecl)
+    |= DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (newdecl);
+  DECL_IS_NOVOPS (newdecl) |= DECL_IS_NOVOPS (olddecl);
+  DECL_IS_NOVOPS (olddecl) |= DECL_IS_NOVOPS (newdecl);
 }
 
 #define GNU_INLINE_P(fn) (DECL_DECLARED_INLINE_P (fn)                  \

Reply via email to