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

syscall: syscall_windows_test.go: cast from pointer to int of different size #9188

Closed
kardianos opened this issue Dec 1, 2014 · 3 comments
Closed
Milestone

Comments

@kardianos
Copy link
Contributor

On Windows 7 x64.
Gcc: 4.8.2 x86_64-w64-mingw32
hg cd4772ba9573 (release-branch.go1.4)

Installed from http://win-builds.org/

System still builds and runs fine. Appears to have appeared after I installed a new
version of gcc (upgraded when I needed the newer version for a different project).

--- FAIL: TestStdcallAndCDeclCallbacks (0.22s)
        syscall_windows_test.go:373: failed to build dll: exit status 1 - test.c: In function 'cdecl2':
                test.c:5:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                  for(i=0;i<(int)n;i++){
                            ^
                test.c:6:3: warning: passing argument 1 of 'f' makes pointer from integer without a cast [enabled by default]
                   f(1,2);
                   ^
                test.c:6:3: note: expected 'void *' but argument is of type 'int'
                test.c:6:3: warning: passing argument 2 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:6:3: note: expected 'void *' but argument is of type 'int'
                test.c: In function 'stdcall2':
...
                test.c:118:3: warning: passing argument 1 of 'f' makes pointer from integer without a cast [enabled by default]
                   f(1,2,3,4,5,6,7,8,9);
                   ^
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 2 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 3 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 4 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 5 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 6 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 7 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 8 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c:118:3: warning: passing argument 9 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:118:3: note: expected 'void *' but argument is of type 'int'
                test.c: In function 'stdcall9':
                test.c:125:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                  for(i=0;i<(int)n;i++){
                            ^
                test.c:126:3: warning: passing argument 1 of 'f' makes pointer from integer without a cast [enabled by default]
                   f(1,2,3,4,5,6,7,8,9);
                   ^
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 2 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 3 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 4 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 5 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 6 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 7 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 8 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'
                test.c:126:3: warning: passing argument 9 of 'f' makes pointer from integer without a cast [enabled by default]
                test.c:126:3: note: expected 'void *' but argument is of type 'int'�
                c:/dev/winbuilds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
                c:/dev/winbuilds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.2/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgcc_s
                collect2.exe: error: ld returned 1 exit status
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.4maybe, os-windows.

@alexbrainman
Copy link
Member

I can break the test, if I use "gcc -Werror ..." to stop build if any warnings.

diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go
index ce8a9ec..8fff9eb 100644
--- a/src/runtime/syscall_windows_test.go
+++ b/src/runtime/syscall_windows_test.go
@@ -379,13 +379,13 @@ var cbDLLs = []cbDLL{
{
"test",
func(out, src string) []string {

  •       return []string{"gcc", "-shared", "-s", "-o", out, src}
    
  •       return []string{"gcc", "-shared", "-s", "-Werror", "-o", out, src}
    },
    
    },
    {
    "testO2",
    func(out, src string) []string {
  •       return []string{"gcc", "-shared", "-s", "-o", out, "-O2", src}
    
  •       return []string{"gcc", "-shared", "-s", "-Werror", "-o", out, "-O2", src}
    },
    
    },
    }

Alex

@bradfitz bradfitz removed the new label Dec 18, 2014
@mikioh mikioh changed the title syscall_windows_test.go: cast from pointer to int of different size syscall: syscall_windows_test.go: cast from pointer to int of different size Dec 20, 2014
@alexbrainman
Copy link
Member

The fix https://go-review.googlesource.com/1930

Alex

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants