diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-20 17:43:55 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-08-20 17:43:55 +0000 |
commit | f4cd6a8d567ba14f7c936e53bf6c65724c6d42b7 (patch) | |
tree | 23b169f2af167f4dd70aba8b1e72e6ae453315a1 /gcc/go | |
parent | f999c862ec256fe170b3dac777b7f34df250c35a (diff) | |
download | gcc-f4cd6a8d567ba14f7c936e53bf6c65724c6d42b7.zip gcc-f4cd6a8d567ba14f7c936e53bf6c65724c6d42b7.tar.gz gcc-f4cd6a8d567ba14f7c936e53bf6c65724c6d42b7.tar.bz2 |
compiler: Don't crash on invalid print call.
When the print builtins are called with no arguments, the compiler
issues a warning and crashes when trying to produce the backend
representation for the arguments.
Fixes golang/go#11526.
Reviewed-on: https://go-review.googlesource.com/13131
From-SVN: r227039
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index b2f305b..853cb4a 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -ec34cfb0b148ff461df12c8f5270a06e2f438b7c +cc7303c97b232ea979cab950d95aaf76c4e0f5b5 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 9f757a2..c0e5fc5 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -8177,6 +8177,12 @@ Builtin_call_expression::do_get_backend(Translate_context* context) location); } + // There aren't any arguments to the print builtin. The compiler + // issues a warning for this so we should avoid getting the backend + // representation for this call. Instead, perform a no-op. + if (print_stmts == NULL) + return context->backend()->boolean_constant_expression(false); + return print_stmts->get_backend(context); } |