public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
@ 2023-11-09 19:38 slyfox at gcc dot gnu.org
2023-11-09 19:49 ` [Bug libstdc++/112467] " pinskia at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-11-09 19:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
Bug ID: 112467
Summary: [14 Regression] libstdc++ fails to build on clang:
bits/stl_bvector.h:189:23: error: '__assume__'
attribute cannot be applied to a statement
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Build failure is probably introduced by r14-5260-ge39b3e02c27bd7 and fails on
clang-16 as:
// $ cat a.cc
#include <vector>
$ clang++ -c a.cc
In file included from a.cc:1:
In file included from /<<NIX>>/gcc-14.0.0/include/c++/14.0.0/vector:67:
/<<NIX>>/gcc-14.0.0/include/c++/14.0.0/bits/stl_bvector.h:189:23: error:
'__assume__' attribute cannot be applied to a statement
__attribute__ ((__assume__ (__ofst < unsigned(_S_word_bit))));
^ ~
1 error generated.
I think it happens because `clang` implements different `assume` attribute
compared to `gcc`: https://clang.llvm.org/docs/AttributeReference.html#assume
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
@ 2023-11-09 19:49 ` pinskia at gcc dot gnu.org
2023-11-09 19:49 ` slyfox at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC/GNUC's assume is the same as the way C++23 attribute is defined ...
Looks like clang decided to implement an attribute assume which is totally
different ...
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
2023-11-09 19:49 ` [Bug libstdc++/112467] " pinskia at gcc dot gnu.org
@ 2023-11-09 19:49 ` slyfox at gcc dot gnu.org
2023-11-09 19:50 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-11-09 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
--- Comment #2 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Filed a feature request on `clang` side to consider implementing it:
https://github.com/llvm/llvm-project/issues/71858
Meanwhile would it be reasonable to enable the attribute only for `gcc`?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
2023-11-09 19:49 ` [Bug libstdc++/112467] " pinskia at gcc dot gnu.org
2023-11-09 19:49 ` slyfox at gcc dot gnu.org
@ 2023-11-09 19:50 ` pinskia at gcc dot gnu.org
2023-11-09 21:15 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09 19:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Sergei Trofimovich from comment #2)
> Meanwhile would it be reasonable to enable the attribute only for `gcc`?
Or rather for !__CLANG__ :).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2023-11-09 19:50 ` pinskia at gcc dot gnu.org
@ 2023-11-09 21:15 ` redi at gcc dot gnu.org
2023-11-09 21:15 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-09 21:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-11-09
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No, for __has_attribute(__assume__)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2023-11-09 21:15 ` redi at gcc dot gnu.org
@ 2023-11-09 21:15 ` redi at gcc dot gnu.org
2023-11-10 8:26 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-09 21:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh, but that's presumably true for clang, just not in this context. Ugh.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (4 preceding siblings ...)
2023-11-09 21:15 ` redi at gcc dot gnu.org
@ 2023-11-10 8:26 ` rguenth at gcc dot gnu.org
2023-11-10 20:58 ` sjames at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-10 8:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (5 preceding siblings ...)
2023-11-10 8:26 ` rguenth at gcc dot gnu.org
@ 2023-11-10 20:58 ` sjames at gcc dot gnu.org
2023-11-10 21:05 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-10 20:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sjames at gcc dot gnu.org
--- Comment #6 from Sam James <sjames at gcc dot gnu.org> ---
I hit the same when building Firefox with Clang which figures.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (6 preceding siblings ...)
2023-11-10 20:58 ` sjames at gcc dot gnu.org
@ 2023-11-10 21:05 ` redi at gcc dot gnu.org
2023-11-11 0:58 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-10 21:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This seems to work:
--- 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (7 preceding siblings ...)
2023-11-10 21:05 ` redi at gcc dot gnu.org
@ 2023-11-11 0:58 ` cvs-commit at gcc dot gnu.org
2023-11-11 1:01 ` redi at gcc dot gnu.org
2024-02-09 8:46 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-11 0:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:
https://gcc.gnu.org/g:807f47497f17ed50be91f0f879308cb6fa063966
commit r14-5350-g807f47497f17ed50be91f0f879308cb6fa063966
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 10 21:06:15 2023 +0000
libstdc++: Do not use assume attribute for Clang [PR112467]
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (8 preceding siblings ...)
2023-11-11 0:58 ` cvs-commit at gcc dot gnu.org
@ 2023-11-11 1:01 ` redi at gcc dot gnu.org
2024-02-09 8:46 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-11-11 1:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
done
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/112467] [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
` (9 preceding siblings ...)
2023-11-11 1:01 ` redi at gcc dot gnu.org
@ 2024-02-09 8:46 ` cvs-commit at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-09 8:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112467
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Torbjorn Svensson
<azoff@gcc.gnu.org>:
https://gcc.gnu.org/g:adef1e0ebeb5055ed4e8776fd3f73c9d84821eaa
commit r13-8310-gadef1e0ebeb5055ed4e8776fd3f73c9d84821eaa
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Nov 10 21:06:15 2023 +0000
libstdc++: Do not use assume attribute for Clang [PR112467]
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.
(cherry picked from commit 807f47497f17ed50be91f0f879308cb6fa063966)
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-02-09 8:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-09 19:38 [Bug libstdc++/112467] New: [14 Regression] libstdc++ fails to build on clang: bits/stl_bvector.h:189:23: error: '__assume__' attribute cannot be applied to a statement slyfox at gcc dot gnu.org
2023-11-09 19:49 ` [Bug libstdc++/112467] " pinskia at gcc dot gnu.org
2023-11-09 19:49 ` slyfox at gcc dot gnu.org
2023-11-09 19:50 ` pinskia at gcc dot gnu.org
2023-11-09 21:15 ` redi at gcc dot gnu.org
2023-11-09 21:15 ` redi at gcc dot gnu.org
2023-11-10 8:26 ` rguenth at gcc dot gnu.org
2023-11-10 20:58 ` sjames at gcc dot gnu.org
2023-11-10 21:05 ` redi at gcc dot gnu.org
2023-11-11 0:58 ` cvs-commit at gcc dot gnu.org
2023-11-11 1:01 ` redi at gcc dot gnu.org
2024-02-09 8:46 ` cvs-commit at gcc dot gnu.org
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).