https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124727
Bug ID: 124727
Summary: simd vec<int> deduced size wrong targeting AVX512
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: ncm at gcc dot gnu.org
Target Milestone: ---
```
$ cat simd_convert_bug.cc
#include <simd>
#include <array>
int main() {
using std::simd::vec, std::simd::flag_convert;
vec<int> v = std::array{0,0,0,0, 0,0,0,1<<30};
char bytes[8];
unchecked_store(v, bytes, flag_convert);
}
$ local/bin/g++-16 -c -std=c++26 -march=znver4 simd_convert_bug.cc
simd_convert_bug.cc: In function ‘int main()’:
simd_convert_bug.cc:5:21: error: conversion from ‘std::array<int, 8>’ to
non-scalar type ‘std::simd::vec<int>’ {aka ‘std::simd::basic_vec<int,
std::simd::_Abi<16, 1, 1> >’} requested
5 | vec<int> v = std::array{0,0,0,0,0,0,0,1<<30};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from local/include/c++/16.0.1/simd:42,
from simd_convert_bug.cc:1:
local/include/c++/16.0.1/bits/simd_loadstore.h: In instantiation of ‘constexpr
void std::simd::unchecked_store(const basic_vec<_Tp, _A0>&, _Rg&&, flags<_Flags
...>) [with _Tp = int; _Ap = _Abi<16, 1, 1>; _Rg = char (&)[8]; _Flags =
{__convert_flag}]’:
simd_convert_bug.cc:7:18: required from here
7 | unchecked_store(v, bytes, flag_convert);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
local/include/c++/16.0.1/bits/simd_loadstore.h:252:41: error: static assertion
failed: given range must have sufficient size
252 | static_assert(ranges::size(__r) >= _TV::size(), "given range
must have sufficient size");
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
• the comparison reduces to ‘(8 >= 16)’
```
Compiled with -march=znver3 or -march=skylake, the build completes.
Compiled with -march=znver4 or -march=skylake-avx512, or apparently
any avx512 target, I get the above errors.+