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

            Bug ID: 120709
           Summary: ICE in expand_builtin_crc_table_based with
                    __builtin_crc8_data8
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qingren2hxb at gmail dot com
  Target Milestone: ---

Created attachment 61664
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61664&action=edit
bug report by using -freport-bug

Input
===========
#include <stdint.h>

uint8_t crc8_data8(uint8_t crc, uint8_t data, uint8_t polynomial) {
  return __builtin_crc8_data8(crc, data, polynomial);
}

int main() {
  uint8_t crc8 = crc8_data8(0x00, 0xAA, 0x07);
  return 0;
}
===========

Output
===========
$gcc -
during RTL pass: expand
test.c: In function 'crc8_data8':
test.c:4:10: internal compiler error: in expand_builtin_crc_table_based, at
builtins.cc:7803
    4 |   return __builtin_crc8_data8(crc, data, polynomial);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x2157cc5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2167ecf internal_error(char const*, ...)
        ???:0
0x7e9f61 fancy_abort(char const*, int, char const*)
        ???:0
0xa82569 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
0xa8e7fc store_expr(tree_node*, rtx_def*, int, bool, bool)
        ???:0
0xa90ed3 expand_assignment(tree_node*, tree_node*, 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.
===========

GCC: gcc version 15.1.0
Target: x86_64-linux-gnu

GCC crashes with an ICE when compiling code where __builtin_crc8_data8 is
wrapped in the crc8_data8 function.

Reply via email to