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

misc/swig: long long not working with gcc 4.7 on Windows #6541

Open
steeve opened this issue Oct 7, 2013 · 8 comments
Open

misc/swig: long long not working with gcc 4.7 on Windows #6541

steeve opened this issue Oct 7, 2013 · 8 comments
Milestone

Comments

@steeve
Copy link
Contributor

steeve commented Oct 7, 2013

What steps will reproduce the problem?
1. grab the file at https://gist.github.com/steeve/6872454
2. on windows/386: go run test-int64.go


What is the expected output?
1

What do you see instead?
4603183328

Which compiler are you using (5g, 6g, 8g, gccgo)?
8g, cgo on mingw32 + msys

Which operating system are you using?
windows 7

Which version are you using?  (run 'go version')
go version go1.1.2 windows/386

Please provide any additional information below.
Running this on darwin/amd64 and windows/amd64 works perfectly.
@steeve
Copy link
Contributor Author

steeve commented Oct 7, 2013

Comment 1:

Just found out that it works perfectly on go 1.2rc1. Maybe I'm in luck though.

@steeve
Copy link
Contributor Author

steeve commented Oct 7, 2013

Comment 2:

However, it still happens when using SWIG, but only if the prototype of the function
uses pointers.
This works:
int64_t get_number(int32_t n)
{
    return 1
}
This doesn't:
int64_t get_number(int32_t *n)
{
    return 1
}

@steeve
Copy link
Contributor Author

steeve commented Oct 7, 2013

Comment 3:

However, it still happens when using SWIG.
This works:
int64_t get_number()
{
    return 1
}
This doesn't:
int64_t get_number(int32_t n)
{
    return 1
}

@rsc
Copy link
Contributor

rsc commented Oct 18, 2013

Comment 4:

The original report was a dup of issue #5603. 
This is now the SWIG equivalent of issue #5603.
The solution is to use __attribute__((__packed__,__gcc_struct__)) when using a non-clang
compiler.

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@steeve
Copy link
Contributor Author

steeve commented Oct 21, 2013

Comment 5:

So it's more likely a SWIG issue then. SWIG is kind of broken on Windows anyway
https://github.com/steeve/libtorrent-go/blob/master/Makefile#L118

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 6:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
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