diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-03-28 22:31:02 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-03-28 22:31:02 +0000 |
commit | 2e540b505941a63f422d865c2a1490193e459d38 (patch) | |
tree | 3266a54e30ca2d8cf212885010822276f35f6a08 /gcc | |
parent | 1fbb888cfc96cf90eb15a772d278ee6c9ddfc64e (diff) | |
download | gcc-2e540b505941a63f422d865c2a1490193e459d38.zip gcc-2e540b505941a63f422d865c2a1490193e459d38.tar.gz gcc-2e540b505941a63f422d865c2a1490193e459d38.tar.bz2 |
compiler: fix null-dereference on invalid len() arg.
This patch fixes an ICE caused by syntax errors in arguments
to unary built-in functions like len().
Updates issue 7.
From Rémy Oudompheng.
From-SVN: r185935
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index f1e0639..13c7de3 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -6609,7 +6609,7 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function, if (this->code_ == BUILTIN_LEN || this->code_ == BUILTIN_CAP) { Expression* arg = this->one_arg(); - if (!arg->is_constant()) + if (arg != NULL && !arg->is_constant()) { Find_call_expression find_call; Expression::traverse(&arg, &find_call); @@ -6929,7 +6929,7 @@ Expression* Builtin_call_expression::one_arg() const { const Expression_list* args = this->args(); - if (args->size() != 1) + if (args == NULL || args->size() != 1) return NULL; return args->front(); } |