MSYS2-packages icon indicating copy to clipboard operation
MSYS2-packages copied to clipboard

basic code segfaults when building for msys

Open pps83 opened this issue 8 months ago • 4 comments

Description / Steps to reproduce the issue

the issue happens only when compiling under msys with -march=haswell.

mkdir test; cd test
git clone https://github.com/lz4/lz4.git

echo '#include <lz4frame.h>' >main.c
echo 'int main()' >>main.c
echo '{' >>main.c
echo '    struct LZ4F_dctx_s* ctx = NULL;' >>main.c
echo '    LZ4F_createDecompressionContext(&ctx, LZ4F_VERSION);' >>main.c
echo '}' >>main.c

cc main.c lz4/lib/lz4.c lz4/lib/lz4frame.c lz4/lib/lz4hc.c lz4/lib/xxhash.c -I lz4/lib -march=haswell
echo running a.exe on $MSYSTEM
./a.exe

note, this exact command works without issues from any of the mingw shells, of from cygwin. It also works without issues if you remove -march=haswell from compile command.

Expected behavior

final ./a.exe should not segfault

Actual behavior

running a.exe on MSYS
Segmentation fault

Verification

  • [x] I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)

Windows Version

MSYS_NT-10.0-26100

Are you willing to submit a PR?

No response

pps83 avatar Apr 28 '25 21:04 pps83