[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    [committed] libstdc++: Do not use assume attribute for Clang [PR112467]
From:       Jonathan Wakely <jwakely () redhat ! com>
Date:       2023-11-11 0:58:14
Message-ID: 20231111005834.93376-1-jwakely () redhat ! com
[Download RAW message or body]

Tested x86_64-linux (-m32 and -m64). Pushed to trunk.

-- >8 --

Clang has an 'assume' attribute, but it's a function attribute not a
statement attribute. The recently-added use of the statement form causes
an error with Clang.

libstdc++-v3/ChangeLog:

	PR libstdc++/112467
	* include/bits/stl_bvector.h (_M_assume_normalized): Do not use
	statement form of assume attribute for Clang.
---
 libstdc++-v3/include/bits/stl_bvector.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index 2b91af2005f..64f04c1f4f5 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -185,8 +185,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     void
     _M_assume_normalized() const
     {
+#if __has_attribute(__assume__) && !defined(__clang__)
       unsigned int __ofst = _M_offset;
       __attribute__ ((__assume__ (__ofst < unsigned(_S_word_bit))));
+#endif
     }
 
     _GLIBCXX20_CONSTEXPR
-- 
2.41.0

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic