public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/113647] New: __builtin_eh_return_data_regno ICEs when passed -1 as argument
@ 2024-01-28 23:20 gabravier at gmail dot com
  2024-01-28 23:42 ` [Bug c/113647] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: gabravier at gmail dot com @ 2024-01-28 23:20 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/113647] __builtin_eh_return_data_regno ICEs when passed -1 as argument
  2024-01-28 23:20 [Bug c/113647] New: __builtin_eh_return_data_regno ICEs when passed -1 as argument gabravier at gmail dot com
@ 2024-01-28 23:42 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-28 23:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113647

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 101195 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-28 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28 23:20 [Bug c/113647] New: __builtin_eh_return_data_regno ICEs when passed -1 as argument gabravier at gmail dot com
2024-01-28 23:42 ` [Bug c/113647] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).