SIGSEGV when compile with `g++ -march=native -g` on Intel with AVX CPUs

I have a problem with g++14.2 and previous versions.

When I compile my program with g++ -march=native -g, the binary creates a SIGSEGV only in Intel CPUs with AVX instruction set. Not in my ARM64 nor in a Core2Duo Intel.

When I compile my program with g++ -g, the binary runs normally in any platform.

When I compile my program with g++ -march=native -O3, the binary runs normally in any platform (optimized out code?).

The place where the SIGSEGV appears, it seems correct. It is just before a call to a member function from another member function.

The assembly instruction where the SIGSEGV appears is:

=> 0x00007ff6074ea2b3 <+67>:    vmovdqa %ymm0,-0x40(%rbp)

but it seems that (rbp-0x40) is not aligned to 32 bytes:

rbp            0x5fec10

Unfortunately my code crashes the clang and ask me to report a bug.

I think that this is compiler specific. But I tried to apply alignas(32) to my definitions like:

alignas(32) band_matrix<const unsigned short*, 10, 2> res2{.....}

but either that way, rbp is not aligned to 32 bytes.

I make a minification of my program, which many times works (probably when rbp is correctly aligned to 32 bytes) and many fails (no output)

#include <cstdint>
#include <iostream>

template<typename It>
struct container_view
{
    typedef typename It::reference reference;
    typedef std::remove_reference_t<reference> value_type;
    typedef const reference const_reference;

    constexpr container_view(It it, size_t s) noexcept : it(it), s(s) {}

    constexpr It begin() const noexcept { return it; }
    constexpr It end() const noexcept { return it + size(); }

    constexpr reference operator[](size_t i) noexcept { return *(it + i); }

    /// Size of container.
    constexpr size_t size() const noexcept { return s; }

private:
    It it;
    size_t s;
};


template<typename T, typename S = const size_t>
struct shifted_vector
{
    typedef std::remove_reference_t<T> vector_type;     ///< The type of vector.
    T vec;                                              ///< DenseVector of sequential non-zero elements.
    S offset;                                           ///< Offset of first non-zero element.
};


struct band_matrix_jump_iterator
{
    typedef short value_type;
    typedef short* pointer;
    typedef short& reference;

private:
    size_t b;   // matrix's bandwidth
    size_t v;   // matrix's column
    size_t e;   // matrix's column's element's index.
    pointer p;  // Pointer to current element.

public:

    constexpr band_matrix_jump_iterator(pointer p, size_t b, size_t v, size_t e) noexcept
        : b{b}, v{v}, e{e}, p{p} {}

    constexpr band_matrix_jump_iterator &operator++() noexcept { ++e; ++p; return *this; }
    constexpr band_matrix_jump_iterator &operator+=(ptrdiff_t i) noexcept { e += i; p += i; return *this; }
    constexpr band_matrix_jump_iterator operator+(ptrdiff_t i) const noexcept
        { band_matrix_jump_iterator t(*this); t += i; return t; }
    constexpr reference operator*() const noexcept { return *p; }
    constexpr bool operator==(const band_matrix_jump_iterator &it) const noexcept { return e == it.e; }
};


struct band_matrix
{
    typedef short value_type;
    typedef value_type* pointer;

    constexpr size_t columns() const noexcept { return 10; }

    size_t b;
    pointer elements;


//---------------------------------------------------------------- TYPEDEFS OF ITERATORS AND VECTORS


    typedef band_matrix_jump_iterator column_iterator;
    typedef shifted_vector<container_view<column_iterator>, const uint8_t> column_vector;



//--------------------------------------------------------------------------- CONSTRUCTORS / ASSIGNS

    constexpr band_matrix(size_t b) : b{b}, elements(new value_type[10]) {}
    constexpr ~band_matrix() noexcept { delete[] elements; }


//------------------------------------------ GET ROWS, COLUMNS, DIAGONAL AND CORRESPONDING ITERATORS


    /// Return a beginning iterator to column c i vector.
    constexpr column_iterator column_begin(size_t i) noexcept
    { return column_iterator(elements + i, 0, i, 0); }


    /// Return a vector view of column c i.
    constexpr column_vector column(size_t i) noexcept
    { return {typename column_vector::vector_type{column_begin(i), 1}, (uint8_t) i}; }
};




using namespace std;

int main()
{
    band_matrix m(0);
    for (size_t i = 0; i < 10; ++i) m.elements[i] = i;

    // checking columns
    for (size_t i = 0; i < m.columns(); ++i)
    {
        auto v = m.column(i);
        cout << (int) v.offset << ": { ";
        for (auto i : v.vec) cout << i << " ";
        cout << "}n";
    }
}

Is this a g++ bug? my code (above) bug?
Any suggestions? (of course the first suggestion is not to use -march=native)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật