Skip to content

CGLM compiled with avx leads to segmentation fault when using mat4 multiplication #479

@RealSomeGuy

Description

@RealSomeGuy

Using cglm with avx leads to glm_mat4_mul segfaulting. I am using mingw-w64 to compile my code with the following flags

-mavx

here is a minimally reproducible example

#include <cglm/mat4.h>
#include <cglm/affine.h>
#include <cglm/io.h>

int main(void)
{
    mat4 a = GLM_MAT4_IDENTITY_INIT;
    mat4 b = GLM_MAT4_IDENTITY_INIT;
    mat4 c = GLM_MAT4_IDENTITY_INIT;

    glm_translate(a, (vec3){2.0f, 0.0f, 3.0f});
    glm_rotate(b, glm_rad(40.0f), (vec3){0.0f, 0.0f, 3.0f});

    glm_mat4_mul(b, a, c);

    glm_mat4_print(c, stdout);
}

this works with SSE, but with avx, it leads to a segmentation fault.

Running it through gdb

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff6a5762e9d in glm_mat4_mul_avx (m1=0x5ff3c0, m2=0x5ff400, dest=0x5ff380)
    at ../../include/cglm/simd/avx/mat4.h:101
101       y0 = glmm256_fmadd(y3, y7, y0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions