]> Cypherpunks repositories - gostls13.git/commitdiff
6g currently accepts setting a string value to an integer
authorIan Lance Taylor <iant@golang.org>
Thu, 25 Sep 2008 22:08:52 +0000 (15:08 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 25 Sep 2008 22:08:52 +0000 (15:08 -0700)
constant without an explicit conversion.  I think that is a
bug.  This adds a test case for it.

Also, change errchk to include the string BUG in error
messages, so that failures are included in the count reported
by the run shell script.

R=r,ken
DELTA=11  (7 added, 0 deleted, 4 changed)
OCL=15857
CL=15880

test/bugs/bug104.go [new file with mode: 0644]
test/errchk
test/golden.out

diff --git a/test/bugs/bug104.go b/test/bugs/bug104.go
new file mode 100644 (file)
index 0000000..dd4bb58
--- /dev/null
@@ -0,0 +1,10 @@
+// errchk $G $D/$F.go
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+func f() string {
+       return 0        // ERROR "conversion|type"
+}
index 19fa1a5ccb1784983e83b64d4f4efc0f22a773e9..2b27b851cd8a44e4f6b94878766611ca99bce037 100755 (executable)
@@ -34,7 +34,7 @@ rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPSTAT
 trap "rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPSTAT" 0 1 2 3 14 15
 
 if $* >$TMPOUT 2>$TMPERR; then
-  echo 1>&2 "errchk: command succeeded unexpectedly: " "$@"
+  echo 1>&2 "BUG: errchk: command succeeded unexpectedly: " "$@"
   cat $TMPOUT
   cat 1>&2 $TMPERR
   rm -f $TMPOUT $TMPERR
@@ -52,17 +52,17 @@ pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
   grep -v "$SOURCEFILE:$lineno" < $TMPALL > $TMPTMP
   mv -f $TMPTMP $TMPALL
   if test -z "$errmsg"; then
-    echo 1>&2 "errchk: $SOURCEFILE: missing expected error message on line $lineno: '$regexp'"
+    echo 1>&2 "BUG: errchk: $SOURCEFILE: missing expected error message on line $lineno: '$regexp'"
     echo 1 > $TMPSTAT
   elif ! echo "$errmsg" | egrep -q "$regexp"; then
-    echo 1>&2 "errchk: $SOURCEFILE: error message on line $lineno does not match '$regexp'"
+    echo 1>&2 "BUG: errchk: $SOURCEFILE: error message on line $lineno does not match '$regexp'"
     echo 1>&2 $errmsg
     echo 1 > $TMPSTAT
   fi
 done
 
 if test -s $TMPALL; then
-  echo 1>&2 "errchk: $SOURCEFILE: unmatched error messages:"
+  echo 1>&2 "BUG: errchk: $SOURCEFILE: unmatched error messages:"
   echo 1>&2 "=================================================="
   cat 1>&2 $TMPALL
   echo 1>&2 "=================================================="
index f82bc7a44e03eb0895243228a3e8e30ffc998631..fe816db09857746eacb62690041c9d9309cadac2 100644 (file)
@@ -166,6 +166,8 @@ SIGSEGV: segmentation violation
 Faulting address: 0x0
 pc: xxx
 
+=========== bugs/bug104.go
+BUG: errchk: command succeeded unexpectedly:  6g bugs/bug104.go
 
 =========== fixedbugs/bug016.go
 fixedbugs/bug016.go:7: overflow converting constant to <uint32>UINT32