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

Always include long long Make_fixed_precision #78

Closed
wants to merge 1 commit into from

Conversation

jrtc27
Copy link
Contributor

@jrtc27 jrtc27 commented Feb 22, 2017

One of the users of this function is getStatInfo in unix_specific, which
converts a struct stat's st_nlink. However, on x32, st_nlink is a 64-bit
quantity (the system call ABI is 64-bit), so there are two problems.
Firstly, it will be truncated; secondly, since the long and int
overloads involve a cast to an integer of the same width, compilation
fails with an ambiguous call.

One of the users of this function is getStatInfo in unix_specific, which
converts a struct stat's st_nlink. However, on x32, st_nlink is a 64-bit
quantity (the system call ABI is 64-bit), so there are two problems.
Firstly, it will be truncated; secondly, since the long and int
overloads involve a cast to an integer of the same width, compilation
fails with an ambiguous call.
@dcjm
Copy link
Contributor

dcjm commented Feb 23, 2017

Thanks for investigating this. I think the #if tests should be changed to
#if (SIZEOF_LONG_LONG != 0)
otherwise compilation could fail if long long isn't present. Perhaps that's not possible.

@jrtc27
Copy link
Contributor Author

jrtc27 commented Feb 23, 2017

Oh I see, that's what's done for arb.h. Is there a reason why you're checking SIZEOF_LONG_LONG rather than HAVE_LONG_LONG?

@dcjm
Copy link
Contributor

dcjm commented Mar 1, 2017

I don't know why it's checking SIZEOF_LONG_LONG. I've changed that in both arb.h/arb.cpp and run_time.h. Has this fixed the problem?

@jrtc27
Copy link
Contributor Author

jrtc27 commented Mar 1, 2017

I will check. I noticed from that commit that you still have the #if SIZEOF_LONG_LONG <= SIZEOF_VOIDP around Make_arbitrary_precision in arb.cpp but not in arb.h. Is there a reason why that's there?

@dcjm
Copy link
Contributor

dcjm commented Mar 1, 2017

Because there are different implementations depending on whether a long long value will fit in a machine word or not.

@jrtc27
Copy link
Contributor Author

jrtc27 commented Mar 1, 2017

Oh right, yes, I should have looked for context. My bad.

@jrtc27
Copy link
Contributor Author

jrtc27 commented Mar 21, 2017

I finally got round to trying this and your fix seems to have worked, as expected; thanks!

@jrtc27 jrtc27 closed this Mar 21, 2017
@jrtc27 jrtc27 deleted the x32 branch March 21, 2017 12:46
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.

None yet

2 participants