diff options
author | Ian Lance Taylor <iant@golang.org> | 2024-08-05 13:01:32 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2024-08-05 16:06:29 -0700 |
commit | ecb6153e3b9895c6e058646262c7c9e9c9c24a3c (patch) | |
tree | 2af06d7ebe2bb18b3e504c3e68aa3913695e6a84 /gcc/go | |
parent | 51db1f307ba395ee322de5adadf56c316e82ae00 (diff) | |
download | gcc-ecb6153e3b9895c6e058646262c7c9e9c9c24a3c.zip gcc-ecb6153e3b9895c6e058646262c7c9e9c9c24a3c.tar.gz gcc-ecb6153e3b9895c6e058646262c7c9e9c9c24a3c.tar.bz2 |
compiler: panic arguments are empty interface type
After CL 536643 passing NULL as the expected type permitted an untyped
constant expression to remain untyped. Change to passing the empty
interface type.
The panic and print/println functions are the only builtin functions
that turn an untyped constant expression into a regular function call,
and we already handled print/println specially.
The test case is https://go.dev/cl/603096.
Fixes golang/go#68734
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/603215
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 9a4b402..e13dc5f 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -60f985a7852632834936b4b859aa75d9df88f038 +5f6fae5ff33e996243acd098c71904695c414c53 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 238d5a5..2b0e40f 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -11137,6 +11137,12 @@ Builtin_call_expression::do_determine_type(Gogo* gogo, is_print = false; break; + case BUILTIN_PANIC: + arg_type = + Type::make_empty_interface_type(Linemap::predeclared_location()); + is_print = false; + break; + case BUILTIN_PRINT: case BUILTIN_PRINTLN: // Do not force a large integer constant to "int". |