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

shift count is negative in int_to_fp_impl for arm64-apple-ios11.0-simulator #69779

Closed
itf opened this issue Oct 20, 2023 · 2 comments
Closed

Comments

@itf
Copy link
Contributor

itf commented Oct 20, 2023

After this commit: 6dfea56,

I see the error:

/int_to_fp_impl.inc:60:29: error: shift count is negative [-Werror,-Wshift-count-negative]
   60 |   const int dstExpBias = (1 << (dstExpBits - 1)) - 1;
      |                             ^  ~~~~~~~~~~~~~~~~
1 error generated.

to reproduce:

clang -nostdlibinc compiler-rt/lib/builtins/floatuntitf.c -fsyntax-only -target arm64-apple-ios11.0-simulator

the error seems to be caused by wrongly assuming the size of a long double

@asb
Copy link
Contributor

asb commented Oct 26, 2023

Thanks for the report! I think we need to move up #if defined(CRT_HAS_TF_MODE) before the int_to_fp_impl.inc include and defines. That target it seems doesn't support __float128 and long double isn't a 128-bit float, so I think those helpers are never compiled.

It looks like int_to_fp.h also shouldn't be making the assumption that long double is a 128-bit float and have an ifdef similar to the one in fp_trunc.h. But I think that's separate to this bug.

@asb
Copy link
Contributor

asb commented Nov 1, 2023

I believe this was fixed by 05a4212 (the original reported bug no longer reproduces). Please reopen if you still have issues.

@asb asb closed this as completed Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants