Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STBIR-NO-UNROLL_LOOP_STAR breaks mingw gcc compilation #1663

Closed
TianZerL opened this issue Jul 18, 2024 · 10 comments
Closed

STBIR-NO-UNROLL_LOOP_STAR breaks mingw gcc compilation #1663

TianZerL opened this issue Jul 18, 2024 · 10 comments

Comments

@TianZerL
Copy link

Describe the bug
#1655 adds STBIR-NO-UNROLL_LOOP_STAR to stb_image_resize2.h, whitch breaks mingw gcc compilation.

/stb_image_resize2.h: In function 'void stbir_simd_memcpy(void*, const void*, size_t)':
/stb_image_resize2.h:2588:12: error: missing loop condition in loop with 'GCC unroll' pragma before ';' token
 2588 |       for(;;)
      |   

To Reproduce
Steps to reproduce the behavior:
Use MinGW-W64 (14.1.0 for me) to build stb_image_resize2.h will get this error.

@yangfl
Copy link
Contributor

yangfl commented Jul 27, 2024

Also on GCC 13/14.

Sample: https://godbolt.org/z/d9jvrxKfK

@jeffrbig2
Copy link

This was tested on GCC at compiler explorer, but I only have mingw my computer in another state. Maybe @TianZerL can check it?

@TianZerL
Copy link
Author

TianZerL commented Jul 29, 2024

@jeffrbig2
I can confirm that #1671 has fixed this for mingw gcc.
But I think there is still issue for clang: https://godbolt.org/z/dv6Tjadrf. Both mingw clang and x86 clang have the same issue.

@jeffrbig2
Copy link

Clang uses completely different pragmas?

@TianZerL
Copy link
Author

@jeffrbig2
No, it should be compatible with gcc, but not completely compatible.
According to llvm/llvm-project#88624, it should have fixed in some versions, but not for Clang 18 in godbolt.
Maybe make _Pragma("GCC unroll 0") for gcc only?

@jeffrbig2
Copy link

Dude, what are you talking about? stb_image_resize2 has a separate clang codepath - it doesn't use the gcc pragmas at all?

Maybe make _Pragma("GCC unroll 0") for gcc only?

It is only for GCC!

@jeffrbig2
Copy link

Look at line 1206-1235...

@TianZerL
Copy link
Author

@jeffrbig2
oops, my bad.

Clang uses completely different pragmas?

I thought this was a question 😂.

@jeffrbig2
Copy link

Haha, ok, cool!!

@nothings
Copy link
Owner

Fix committed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants