diff mbox

Go patch committed: Fix error reporting for invalid builtin calls

Message ID CAOyqgcWiyEUxd38c+iNyQob-rxOpsqN+LORy2sgQKxd074wMtg@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor July 31, 2015, 11:17 p.m. UTC
This patch from Chris Manghane fixes the Go frontend error reporting
for invalid builtin calls, by not losing track of whether the call is
erroneous.  This fixes https://golang.org/issue/11561.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

Comments

Andreas Schwab Aug. 3, 2015, 9:10 a.m. UTC | #1
Ian Lance Taylor <iant@golang.org> writes:

> This patch from Chris Manghane fixes the Go frontend error reporting
> for invalid builtin calls, by not losing track of whether the call is
> erroneous.  This fixes https://golang.org/issue/11561.  Bootstrapped
> and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
> mainline.

../../../libgo/runtime/mprof.goc: In function 'runtime_Stack':
../../../libgo/runtime/mprof.goc:408:5: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address]
  sp = runtime_getcallersp(&b);
     ^

Andreas.
Richard Biener Aug. 3, 2015, 11:15 a.m. UTC | #2
On Mon, Aug 3, 2015 at 11:10 AM, Andreas Schwab <schwab@suse.de> wrote:
> Ian Lance Taylor <iant@golang.org> writes:
>
>> This patch from Chris Manghane fixes the Go frontend error reporting
>> for invalid builtin calls, by not losing track of whether the call is
>> erroneous.  This fixes https://golang.org/issue/11561.  Bootstrapped
>> and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
>> mainline.
>
> ../../../libgo/runtime/mprof.goc: In function 'runtime_Stack':
> ../../../libgo/runtime/mprof.goc:408:5: error: calling '__builtin_frame_address' with a nonzero argument is unsafe [-Werror=frame-address]
>   sp = runtime_getcallersp(&b);
>      ^

Introduced by Martin Sebors patch

2015-08-02  Martin Sebor  <msebor@redhat.com>

        * c-family/c.opt (-Wframe-address): New warning option.
        * doc/invoke.texi (Wframe-address): Document it.
        * doc/extend.texi (__builtin_frame_address, __builtin_return_address):
        Clarify possible effects of calling the functions with non-zero
        arguments and mention -Wframe-address.
        * builtins.c (expand_builtin_frame_address): Handle -Wframe-address.


Richard.

> Andreas.
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
diff mbox

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 226456)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-bc4dda16f8686ab6e7335adfdfd2c6cc81cb2eb5
+2bf7c643a1d2f8503070c8e6cb87852026e32400
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 226122)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -8499,7 +8499,8 @@  Call_expression::do_lower(Gogo* gogo, Na
     {
       if (!this->fn_->type()->is_error())
 	this->report_error(_("expected function"));
-      return Expression::make_error(loc);
+      this->set_is_error();
+      return this;
     }
 
   // Handle an argument which is a call to a function which returns