public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110403] New: constant expression inside vector_size __attribute__ does not compile
@ 2023-06-25 11:29 janezz55 at gmail dot com
  2023-06-25 23:57 ` [Bug c++/110403] dependent function constexpr " janezz55 at gmail dot com
  2023-06-26 13:45 ` ppalka at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: janezz55 at gmail dot com @ 2023-06-25 11:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110403

            Bug ID: 110403
           Summary: constant expression inside vector_size __attribute__
                    does not compile
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janezz55 at gmail dot com
  Target Milestone: ---

trying to compile:

template <typename T, std::size_t N>
using array_t __attribute__ ((vector_size(std::bit_ceil(N * sizeof(T))))) = T;

produces the following compile error:

error: 'vector_size' attribute argument value 'std::bit_ceil<long unsigned
int>((8 * sizeof (unsigned int)))' is not an integer constant

but without bit_ceil(), the following error may result:

error: number of vector components 3 not a power of two.

IMO, this is a bug, since N * sizeof(T) compiles without issue, but a call to a
constexpr function does not.

I have prepared an example:
https://wandbox.org/permlink/lGvFnhDCLJ05j1FM

The idea is to use a SIMD register instead of an array on the stack for
temporary storage.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-26 13:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 11:29 [Bug c++/110403] New: constant expression inside vector_size __attribute__ does not compile janezz55 at gmail dot com
2023-06-25 23:57 ` [Bug c++/110403] dependent function constexpr " janezz55 at gmail dot com
2023-06-26 13:45 ` ppalka 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).