[Bug c/113647] New: __builtin_eh_return_data_regno ICEs when passed -1 as argument
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jan 28 23:20:42 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113647
Bug ID: 113647
Summary: __builtin_eh_return_data_regno ICEs when passed -1 as
argument
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
int f()
{
return __builtin_eh_return_data_regno(-1);
}
This crashes GCC with the following error:
during RTL pass: expand
<source>: In function 'int f()':
<source>:440:42: internal compiler error: in tree_to_uhwi, at tree.cc:6472
440 | return __builtin_eh_return_data_regno(-1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
0x2647edc internal_error(char const*, ...)
???:0
0xa51cb7 fancy_abort(char const*, int, char const*)
???:0
0xf34aa6 expand_builtin_eh_return_data_regno(tree_node*)
???:0
0xf6381c expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
???:0
0xf6ef5e store_expr(tree_node*, rtx_def*, int, bool, bool)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
This seems to be due to the following code:
```
rtx
expand_builtin_eh_return_data_regno (tree exp)
{
tree which = CALL_EXPR_ARG (exp, 0);
unsigned HOST_WIDE_INT iwhich;
if (TREE_CODE (which) != INTEGER_CST)
{
error ("argument of %<__builtin_eh_return_regno%> must be constant");
return constm1_rtx;
}
iwhich = tree_to_uhwi (which); // <-- THIS
```
wherein it looks like `tree_to_uhwi` asserts that its argument is non-negative,
meaning -1 (and all other negative numbers) fail.
More information about the Gcc-bugs
mailing list