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

Workaround for a gcc7 compiler bug #50

Merged
merged 1 commit into from
May 15, 2017
Merged

Workaround for a gcc7 compiler bug #50

merged 1 commit into from
May 15, 2017

Conversation

orbea
Copy link
Contributor

@orbea orbea commented May 15, 2017

When compiled with gcc7, the bsnes-accuracy core will enter an infinite loop while compiling this code with -fstrict-aliasing.

 template<unsigned bits> inline uintmax_t uclip(const uintmax_t x) {
   enum : uintmax_t { b = 1ull << (bits - 1), m = b * 2 - 1 };
   return (x & m);
 }

This specifically happens with return x;.

As a temporary workaround until a proper solution can be found I suggest setting -fno-strict-aliasing for this particular code with a #pragma. This is further guarded so that it will only be applied for the accuracy profile and gcc newer than 7. I tested this with both gcc and clang where it compiled correctly.

See this issue for more information. #47

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

Successfully merging this pull request may close these issues.

2 participants