-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Recent changes to tds.go mean compilation on GOARCH=386 is no longer possible #39
Comments
(pinging @PeteBassettBet365, as author of affected |
@jimbobmcgee it would be fine to add a 386-specific .go file to fix this. Additionally, since 32 bit compilation is still needed, can you add a 32bit build to the appveyor PR verification job? I don't think it's being tested at all. |
Would there be any value in having the 32bit version of the code revert to the prior non-optimized behavior for now? it might be a quicker solution to implement |
Yes, that's indeed what I meant, when I suggested using the build tags...
It may then be feasible to do x86-based pointer maths in a later iteration (for someone who understands what that It is worth noting that it might be that the optimised version only works on x64, in which case Of course, if that someone thinks the pointer maths is easy enough to port to all supported platforms, then doing so in a single ucs22str.go file within a
I am not familiar with Appveyor. Is it something you can add to the PR (if you'd like me to raise one)? |
if you fix the 32bit compile as you described with the second go file, I will add the 32bit build to the PR checks myself. |
Having just seen your CONTRIBUTING.md, I might not be able to make this change for you. I will check on Monday. |
@shueybubbles - as feared; work are happy enough for me to submit the patch, but not happy enough to countersign a CLA document. Please advise how/if you want me to proceed. |
Ok we'll try to get to it soon. |
Testing with
|
Describe the bug
Recent changes to tds.go mean compilation on
GOARCH=386
is no longer possible. As far as I can tell, it is only this file currently preventing support for 386.To Reproduce
Expected behavior
Compilation should be able to succeed, regardless of
GOARCH
Further technical details
Line 489 (as of v0.15) reads...
The
len(s)
infersint
, which is 32 bits on x86 platforms, but0xFFFFFFF8
does not coerce to a 32-bit int. I can change this tovar nlen8 int64 = int64(len(s)) & 0xFFFFFFF8
and add some extra casts further down to resolve simple comparison mismatches, and it will compile, but there is someunsafe.Pointer
math going on in/around this variable, which I don't immediately understand, and I am not confident it won't lead to a problem further down the line if I PR based on this simplistic fix.Additional context
In the meantime, I have had to vendor the module, and cherry-pick
func ucs22str
from the previous version. If the pointer math is not trivial to resolve in x86, perhaps the sanest approach is to move this function out of tds.go into its own code files ucs22str.go and ucs22str_386.go and use+build
tags to conditionally compile both versions -- I could PR that if it suits?The text was updated successfully, but these errors were encountered: