]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: panic arguments are empty interface type
authorIan Lance Taylor <iant@golang.org>
Mon, 5 Aug 2024 20:01:32 +0000 (13:01 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 5 Aug 2024 23:06:29 +0000 (16:06 -0700)
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

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc

index 9a4b402573a63b1c4b1a001cc9409177a849642d..e13dc5f58a3d0e463faf87e798f766d2f42e96b7 100644 (file)
@@ -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.
index 238d5a56ca2ae70ba1dc49de9016a2b8574c0f6b..2b0e40fc6f81fc76ad99c4742f22aca4bba0ec63 100644 (file)
@@ -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".