GCC warnings

35 views
Skip to first unread message

Albert Strasheim

unread,
Apr 14, 2011, 4:59:00 AM4/14/11
to golang-dev
Hello all

With the build now using -Werror, I am having some build problems with
GCC 4.6 on Fedora 15.

tip currently produces the following warnings:

go/src/libmach/executable.c:994:11: warning: variable 'swab' set but
not used [-Wunused-but-set-variable]
go/src/cmd/6l/asm.c:684:29: warning: variable 'w' set but not used [-
Wunused-but-set-variable]
go/src/cmd/6l/asm.c:684:12: warning: variable 'va' set but not used [-
Wunused-but-set-variable]
../ld/data.c:879:38: warning: variable 'bss' set but not used [-
Wunused-but-set-variable]
../ld/dwarf.c:1382:16: warning: variable 'linksize' set but not used [-
Wunused-but-set-variable]
../ld/ldelf.c:322:13: warning: variable 'dp' set but not used [-
Wunused-but-set-variable]
go/src/cmd/6l/obj.c:383:21: warning: variable 'di' set but not used [-
Wunused-but-set-variable]
../ld/lib.c:1036:19: warning: variable 'last' set but not used [-
Wunused-but-set-variable]
go/src/cmd/gc/dcl.c:700:12: warning: variable 'init' set but not used
[-Wunused-but-set-variable]
go/src/cmd/gc/reflect.c:140:6: warning: variable 'o' set but not used
[-Wunused-but-set-variable]
go/src/cmd/gc/reflect.c:243:6: warning: variable 'o' set but not used
[-Wunused-but-set-variable]
go/src/cmd/gc/swt.c:253:13: warning: variable 'oc' set but not used [-
Wunused-but-set-variable]
go/src/cmd/gc/swt.c:253:8: warning: variable 'os' set but not used [-
Wunused-but-set-variable]
go/src/cmd/gc/walk.c:200:12: warning: variable 'init' set but not used
[-Wunused-but-set-variable]
go/src/cmd/gc/walk.c:383:10: warning: variable 'lno' set but not used
[-Wunused-but-set-variable]
go/src/cmd/gc/subr.c:663:12: warning: variable 'init' set but not used
[-Wunused-but-set-variable]
go/src/cmd/gc/subr.c:1731:6: warning: variable 'ptr' set but not used
[-Wunused-but-set-variable]
go/src/cmd/6g/reg.c:1196:8: warning: variable 'p' set but not used [-
Wunused-but-set-variable]

This warning could be disabled, but I think it could turn up some
potential bugs.

Regards

Albert

Lorenzo Stoakes

unread,
Apr 14, 2011, 6:00:04 AM4/14/11
to Albert Strasheim, golang-dev
This may be something to do with my particular configuration, however
on linux/386 I am getting a number of 'rm: cannot remove `build.out':
Text file busy' errors on build which seems to be preventing the
package from building correctly.

--
Lorenzo Stoakes
http://www.codegrunt.co.uk

peterGo

unread,
Apr 14, 2011, 7:49:40 AM4/14/11
to golang-dev
Lorenzo,

Is your problem related to this recent change?

build: tidy intermediate files during build
https://code.google.com/p/go/source/detail?r=3b7654f28a02511e4f9d3be392cab279ed8be37d

Peter

On Apr 14, 6:00 am, Lorenzo Stoakes <lstoa...@gmail.com> wrote:
> This may be something to do with my particular configuration, however
> on linux/386 I am getting a number of 'rm: cannot remove `build.out':
> Text file busy' errors on build which seems to be preventing the
> package from building correctly.
>

Lorenzo Stoakes

unread,
Apr 14, 2011, 8:09:21 AM4/14/11
to peterGo, golang-dev
On 14 April 2011 12:49, peterGo <go.pe...@gmail.com> wrote:
> Lorenzo,
>
> Is your problem related to this recent change?
>
> build: tidy intermediate files during build
> https://code.google.com/p/go/source/detail?r=3b7654f28a02511e4f9d3be392cab279ed8be37d
>

Potentially; I am briefly using a mac where this problem does *not*
arise, once I am back on the linux box I shall investigate :) - I'd
certainly be surprised if it was the -Werror change, as that seems
unrelated.

Cheers, Lorenzo

peterGo

unread,
Apr 14, 2011, 8:28:02 AM4/14/11
to golang-dev
Lorenzo,

I've just successfully run ./all.bash on linux/386 (Ubuntu 10.10) hg
id 165b8254aee1.

Peter

On Apr 14, 8:09 am, Lorenzo Stoakes <lstoa...@gmail.com> wrote:
> On 14 April 2011 12:49, peterGo <go.peter...@gmail.com> wrote:
>
> > Lorenzo,
>
> > Is your problem related to this recent change?
>
> > build: tidy intermediate files during build
> >https://code.google.com/p/go/source/detail?r=3b7654f28a02511e4f9d3be3...

Adam Langley

unread,
Apr 14, 2011, 8:52:31 AM4/14/11
to Lorenzo Stoakes, peterGo, golang-dev
On Thu, Apr 14, 2011 at 8:09 AM, Lorenzo Stoakes <lsto...@gmail.com> wrote:
> Potentially; I am briefly using a mac where this problem does *not*
> arise, once I am back on the linux box I shall investigate :) - I'd
> certainly be surprised if it was the -Werror change, as that seems
> unrelated.

Is NFS involved when the problem occurs?


AGL

Lorenzo Stoakes

unread,
Apr 14, 2011, 9:05:47 AM4/14/11
to Adam Langley, peterGo, golang-dev
On 14 April 2011 13:52, Adam Langley <a...@golang.org> wrote:
> Is NFS involved when the problem occurs?

No, 'vboxsf' - I am running linux in a virtualbox vm and the go folder
is sat in a shared folder from the host system, which itself is sat in
a truecrypt volume, so it's pretty sloooow.

uname -a gives:-

Linux loki 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:40:58 UTC 2011 i686 GNU
/Linux

I will try the revision before the CL Peter mentions. 165b8254aee1
does *not* build for me.

Lorenzo Stoakes

unread,
Apr 14, 2011, 9:13:57 AM4/14/11
to Adam Langley, peterGo, golang-dev
Ok, so it's confirmed - 3b7654f28a02 is the culprit - ffae8b88f004
builds but 3b7654f28a02 does not.

Russ Cox

unread,
Apr 14, 2011, 9:26:46 AM4/14/11
to Lorenzo Stoakes, Albert Strasheim, golang-dev
On Thu, Apr 14, 2011 at 06:00, Lorenzo Stoakes <lsto...@gmail.com> wrote:
> This may be something to do with my particular configuration, however
> on linux/386 I am getting a number of 'rm: cannot remove `build.out':
> Text file busy' errors on build which seems to be preventing the
> package from building correctly.

What do you mean by "seems to"? Does the build stop or not?

It does appear that the build is now removing build.out
while it is still open for reading, but that is typically allowed
by Unix file systems. Even if it produced an error, the
command that is doing the remove is rm -f, which should
still exit successfully in that case.

Russ

Lorenzo Stoakes

unread,
Apr 14, 2011, 9:31:09 AM4/14/11
to Russ Cox, Albert Strasheim, golang-dev
On 14 April 2011 14:26, Russ Cox <r...@google.com> wrote:
> What do you mean by "seems to"?  Does the build stop or not?

Sorry I meant to say that that seems to be the *cause* of the build
failing - yes the build does stop.

>
> It does appear that the build is now removing build.out
> while it is still open for reading, but that is typically allowed
> by Unix file systems.  Even if it produced an error, the
> command that is doing the remove is rm -f, which should
> still exit successfully in that case.

This could be a peculiarity of vboxsf (virtual box shared folder), I
even tried alias rm='rm -f' with no effect (before I knew the build
used -f anyway).I will try copying the folder to a non-shared folder
and building.

Lorenzo Stoakes

unread,
Apr 14, 2011, 9:42:59 AM4/14/11
to Russ Cox, Albert Strasheim, golang-dev
On 14 April 2011 14:31, Lorenzo Stoakes <lsto...@gmail.com> wrote:
> This could be a peculiarity of vboxsf (virtual box shared folder), I
> even tried alias rm='rm -f' with no effect (before I knew the build
> used -f anyway).I will try copying the folder to a non-shared folder
> and building.

This worked; clearly related to vboxsf. Very strange; this seems to be
a known issue with vboxsf, however -
http://askubuntu.com/questions/22824/cant-modify-files-in-my-shared-folder-virtualbox-guest-is-ubuntu-host-is-wind

(I am using a windows host on this box)

Russ Cox

unread,
Apr 14, 2011, 10:19:27 AM4/14/11
to Lorenzo Stoakes, Albert Strasheim, golang-dev
It would help if you could send the actual output
from the build failure.

Russ

Lorenzo Stoakes

unread,
Apr 14, 2011, 10:34:36 AM4/14/11
to Russ Cox, Albert Strasheim, golang-dev

%%%% making pkg %%%%

make: Entering directory `/home/lorenzo/Dropbox/code/go/src/pkg'
install runtime
install sync/atomic
install unicode
install math
INSTALL FAIL sync/atomic
make[1]: Entering directory `/home/lorenzo/Dropbox/code/go/src/pkg/sync/atomic'
8g -o _go_.8 doc.go
8a asm_386.s
rm -f _obj/sync/atomic.a
gopack grc _obj/sync/atomic.a _go_.8 asm_386.8
cp _obj/sync/atomic.a
"/home/lorenzo/Dropbox/code/go/pkg/linux_386/sync/atomic.a"
rm -rf *.o *.a *.[568vq] [568vq].out *.so _obj _test _testmain.go
*.exe _cgo* *.cgo[12].* test.out build.out


rm: cannot remove `build.out': Text file busy

make[1]: *** [install.clean] Error 1
make[1]: Leaving directory `/home/lorenzo/Dropbox/code/go/src/pkg/sync/atomic'
make: *** [sync/atomic.install] Error 1
make: *** Waiting for unfinished jobs....
INSTALL FAIL unicode
make[1]: Entering directory `/home/lorenzo/Dropbox/code/go/src/pkg/unicode'
8g -o _go_.8 casetables.go digit.go letter.go tables.go
rm -f _obj/unicode.a
gopack grc _obj/unicode.a _go_.8
cp _obj/unicode.a "/home/lorenzo/Dropbox/code/go/pkg/linux_386/unicode.a"
rm -rf *.o *.a *.[568vq] [568vq].out *.so _obj _test _testmain.go
*.exe _cgo* *.cgo[12].* test.out build.out maketables


rm: cannot remove `build.out': Text file busy

make[1]: *** [install.clean] Error 1
make[1]: Leaving directory `/home/lorenzo/Dropbox/code/go/src/pkg/unicode'
make: *** [unicode.install] Error 1
INSTALL FAIL math
make[1]: Entering directory `/home/lorenzo/Dropbox/code/go/src/pkg/math'
8g -o _go_.8 acosh.go asinh.go atanh.go bits.go cbrt.go const.go
copysign.go erf.go exp_port.go fdim.go gamma.go hypot_port.go j0.go
j1.go jn.go lgamma.go logb.go nextafter.go pow.go pow10.go signbit.go
sinh.go sqrt_port.go tanh.go unsafe.go asin_decl.go atan_decl.go
atan2_decl.go exp_decl.go exp2_decl.go expm1_decl.go fabs_decl.go
floor_decl.go frexp_decl.go fmod_decl.go hypot_decl.go ldexp_decl.go
log_decl.go log10_decl.go log1p_decl.go modf_decl.go remainder_decl.go
sin_decl.go sincos_decl.go sqrt_decl.go tan_decl.go
8a asin_386.s
8a atan_386.s
8a atan2_386.s
8a exp_386.s
8a exp2_386.s
8a expm1_386.s
8a fabs_386.s
8a floor_386.s
8a frexp_386.s
8a fmod_386.s
8a hypot_386.s
8a ldexp_386.s
8a log_386.s
8a log10_386.s
8a log1p_386.s
8a modf_386.s
8a remainder_386.s
8a sin_386.s
8a sincos_386.s
8a sqrt_386.s
8a tan_386.s
rm -f _obj/math.a
gopack grc _obj/math.a _go_.8 asin_386.8 atan_386.8 atan2_386.8
exp_386.8 exp2_386.8 expm1_386.8 fabs_386.8 floor_386.8 frexp_386.8
fmod_386.8 hypot_386.8 ldexp_386.8 log_386.8 log10_386.8 log1p_386.8
modf_386.8 remainder_386.8 sin_386.8 sincos_386.8 sqrt_386.8 tan_386.8
cp _obj/math.a "/home/lorenzo/Dropbox/code/go/pkg/linux_386/math.a"
rm -rf *.o *.a *.[568vq] [568vq].out *.so _obj _test _testmain.go
*.exe _cgo* *.cgo[12].* test.out build.out


rm: cannot remove `build.out': Text file busy

make[1]: *** [install.clean] Error 1
make[1]: Leaving directory `/home/lorenzo/Dropbox/code/go/src/pkg/math'
make: *** [math.install] Error 1
INSTALL FAIL runtime
make[1]: Entering directory `/home/lorenzo/Dropbox/code/go/src/pkg/runtime'
cp runtime.h "/home/lorenzo/Dropbox/code/go/pkg/linux_386/runtime.h"
cp cgocall.h "/home/lorenzo/Dropbox/code/go/pkg/linux_386/cgocall.h"
quietgcc -o mkversion -I "/home/lorenzo/Dropbox/code/go/include"
mkversion.c "/home/lorenzo/Dropbox/code/go/lib/lib9.a"
(echo 'package runtime'; echo 'const theGoos = "linux"') >version_linux.go
(echo 'package runtime'; echo 'const theGoarch = "386"') >version_386.go
CC="8c" CFLAGS="-Ilinux -I386 -Ilinux/386 -wF " ./mkgodefs.sh proc.c
iface.c hashmap.c chan.c > runtime_defs.go.x
mv -f runtime_defs.go.x runtime_defs.go
8c -Ilinux -I386 -Ilinux/386 -wF -a proc.c >runtime.acid.386
quietgcc -o goc2c goc2c.c
8c -Ilinux -I386 -Ilinux/386 -wF amd64/traceback.c
GOROOT="/home/lorenzo/Dropbox/code/go" ./mkversion >version.go
./mkasmh.sh >386/asm.h.x
mv -f 386/asm.h.x 386/asm.h
8g -+ -o _go_.8 debug.go error.go extern.go mem.go sig.go
softfloat64.go type.go version.go version_linux.go version_386.go
runtime_defs.go
8a 386/asm.s
8c -Ilinux -I386 -Ilinux/386 -wF -o "cgocall.8" cgocall.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "chan.8" chan.c
8c -Ilinux -I386 -Ilinux/386 -wF 386/closure.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "cpuprof.8" cpuprof.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "float.8" float.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "complex.8" complex.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "hashmap.8" hashmap.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "iface.8" iface.c
./goc2c "`pwd`/malloc.goc" > malloc.c.tmp
8c -Ilinux -I386 -Ilinux/386 -wF -o "mcache.8" mcache.c
mv -f malloc.c.tmp malloc.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "mcentral.8" mcentral.c
8c -Ilinux -I386 -Ilinux/386 -wF linux/mem.c
8a 386/memmove.s
8c -Ilinux -I386 -Ilinux/386 -wF -o "mfinal.8" mfinal.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "mfixalloc.8" mfixalloc.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "mgc0.8" mgc0.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "mheap.8" mheap.c
./goc2c "`pwd`/mprof.goc" > mprof.c.tmp
8c -Ilinux -I386 -Ilinux/386 -wF -o "msize.8" msize.c
mv -f mprof.c.tmp mprof.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "print.8" print.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "proc.8" proc.c
./goc2c "`pwd`/reflect.goc" > reflect.c.tmp
8c -Ilinux -I386 -Ilinux/386 -wF -o "rune.8" rune.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "runtime.8" runtime.c
mv -f reflect.c.tmp reflect.c
./goc2c "`pwd`/runtime1.goc" > runtime1.c.tmp
8a linux/386/rt0.s
./goc2c "`pwd`/sema.goc" > sema.c.tmp
8c -Ilinux -I386 -Ilinux/386 -wF linux/386/signal.c
mv -f runtime1.c.tmp runtime1.c
./goc2c "`pwd`/sigqueue.goc" > sigqueue.c.tmp
mv -f sema.c.tmp sema.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "slice.8" slice.c
./goc2c "`pwd`/string.goc" > string.c.tmp
8c -Ilinux -I386 -Ilinux/386 -wF -o "symtab.8" symtab.c
mv -f sigqueue.c.tmp sigqueue.c
8a linux/386/sys.s
mv -f string.c.tmp string.c
8c -Ilinux -I386 -Ilinux/386 -wF linux/thread.c
8a 386/vlop.s
8c -Ilinux -I386 -Ilinux/386 -wF 386/vlrt.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "malloc.8" malloc.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "mprof.8" mprof.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "reflect.8" reflect.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "runtime1.8" runtime1.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "sema.8" sema.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "sigqueue.8" sigqueue.c
8c -Ilinux -I386 -Ilinux/386 -wF -o "string.8" string.c
rm -f _obj/runtime.a
gopack grc _obj/runtime.a _go_.8 asm.8 cgocall.8 chan.8 closure.8
cpuprof.8 float.8 complex.8 hashmap.8 iface.8 malloc.8 mcache.8
mcentral.8 mem.8 memmove.8 mfinal.8 mfixalloc.8 mgc0.8 mheap.8 mprof.8
msize.8 print.8 proc.8 reflect.8 rune.8 runtime.8 runtime1.8 rt0.8
sema.8 signal.8 sigqueue.8 slice.8 string.8 symtab.8 sys.8 thread.8
traceback.8 vlop.8 vlrt.8
cp _obj/runtime.a "/home/lorenzo/Dropbox/code/go/pkg/linux_386/runtime.a"
rm -rf *.o *.a *.[568vq] [568vq].out version.go version_*.go *.so _obj
_test _testmain.go *.exe _cgo* *.cgo[12].* test.out build.out


rm: cannot remove `build.out': Text file busy

make[1]: *** [install.clean] Error 1
rm reflect.c string.c sema.c sigqueue.c runtime1.c malloc.c mprof.c
make[1]: Leaving directory `/home/lorenzo/Dropbox/code/go/src/pkg/runtime'
make: *** [runtime.install] Error 1
make: Leaving directory `/home/lorenzo/Dropbox/code/go/src/pkg'

Russ Cox

unread,
Apr 14, 2011, 10:37:43 AM4/14/11
to Lorenzo Stoakes, Albert Strasheim, golang-dev
If you cd into your "interesting" file system,
what happens if you run

rm -rf build.out >build.out
echo $?

Dave Cheney

unread,
Apr 14, 2011, 10:38:27 AM4/14/11
to Lorenzo Stoakes, Russ Cox, Albert Strasheim, golang-dev
Hi Lorenzo

Are you able to demonstrate the build failure outside a path that is monitored by some sort of external file sync tool?

Cheers

Dave


Sent from my C64

Lorenzo Stoakes

unread,
Apr 14, 2011, 10:42:18 AM4/14/11
to r...@golang.org, Albert Strasheim, golang-dev

lorenzo@loki:/home/lorenzo/Dropbox/code/go/src/cmd$ rm -rf build.out>build.out


rm: cannot remove `build.out': Text file busy

lorenzo@loki:/home/lorenzo/Dropbox/code/go/src/cmd$ echo $?
1

Lorenzo Stoakes

unread,
Apr 14, 2011, 10:44:18 AM4/14/11
to Dave Cheney, Russ Cox, Albert Strasheim, golang-dev
On 14 April 2011 15:38, Dave Cheney <da...@cheney.net> wrote:
> Hi Lorenzo
>
> Are you able to demonstrate the build failure outside a path that is monitored by some sort of external file sync tool?
>

I will try this and get back to you.

Lorenzo Stoakes

unread,
Apr 14, 2011, 10:54:26 AM4/14/11
to Dave Cheney, Russ Cox, Albert Strasheim, golang-dev
On 14 April 2011 15:44, Lorenzo Stoakes <lsto...@gmail.com> wrote:
> On 14 April 2011 15:38, Dave Cheney <da...@cheney.net> wrote:
>> Hi Lorenzo
>>
>> Are you able to demonstrate the build failure outside a path that is monitored by some sort of external file sync tool?
>>
>
> I will try this and get back to you.

Tried it out - still fails. Looks like it's definitely vboxsf.

Lorenzo Stoakes

unread,
Apr 14, 2011, 1:21:56 PM4/14/11
to Dave Cheney, Russ Cox, Albert Strasheim, golang-dev
A simple solution to this problem is to plonk '|| true' on each rm
line; since this is simply a quick optimisation, this prevents the
build breaking in *weird* situations like my vboxsf folder.

I've submitted a trivial CL for this at http://codereview.appspot.com/4412045

Cheers, Lorenzo

Ian Lance Taylor

unread,
Apr 14, 2011, 1:23:09 PM4/14/11
to Russ Cox, Lorenzo Stoakes, Albert Strasheim, golang-dev
Russ Cox <r...@google.com> writes:

> It does appear that the build is now removing build.out
> while it is still open for reading, but that is typically allowed
> by Unix file systems. Even if it produced an error, the
> command that is doing the remove is rm -f, which should
> still exit successfully in that case.

I believe POSIX says that rm -f must exit successfully if the file does
not exist, but that if the file exists but removing it fails, rm is
supposed to exit with a failure status. That is, -f means ignore ENOENT
but does not mean ignore other errors.

Ian

Lorenzo Stoakes

unread,
Apr 14, 2011, 1:24:11 PM4/14/11
to Ian Lance Taylor, Russ Cox, Albert Strasheim, golang-dev
On 14 April 2011 18:23, Ian Lance Taylor <ia...@google.com> wrote:

> I believe POSIX says that rm -f must exit successfully if the file does
> not exist, but that if the file exists but removing it fails, rm is
> supposed to exit with a failure status.  That is, -f means ignore ENOENT
> but does not mean ignore other errors.

I believe the error here is ETXTBSY, hence it not being ignored.

r

unread,
Apr 14, 2011, 12:22:35 PM4/14/11
to golang-dev, r...@google.com
Disable the flag for now if it's giving you trouble. Later today I'll
go through this list and clean them up.

Thanks for the detailed list.

-rob

Albert Strasheim

unread,
Apr 15, 2011, 12:48:20 AM4/15/11
to golang-dev
Hello

On Apr 14, 6:22 pm, r <r...@google.com> wrote:
> Disable the flag for now if it's giving you trouble. Later today I'll
> go through this list and clean them up.
> Thanks for the detailed list.

There's one more left. Not sure why it didn't show up in my initial
list. Might be that GCC only warns once per line.

I think this one might also be fixed by another CL that hasn't been
checked in yet.

Anyway:

go/src/cmd/6l/asm.c:684:21: warning: variable 'fo' set but not used [-
Wunused-but-set-variable]

Regards

Albert
Reply all
Reply to author
Forward
0 new messages