Go patch committed: Panic arguments have empty interface type
Checks
Commit Message
This patch to the Go frontend determines that panic arguments are
empty interfaces. After https://go.dev/cl//536643 passing NULL as the
expected type permitted an untyped constant expression to remain
untyped. This change will fix them to take on 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.
This fixes https://go.dev/issue/68734. The test case is
https://go.dev/cl/603096.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed
to mainline and GCC 14 branch.
Ian
6d1dc17a816ed557cf5eda13019d7d85053f39f2
@@ -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.
@@ -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".