[Bug tree-optimization/126977] New: [17 Regression] factor_out_conditional_operation breaks __builtin_crc* handling

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126977

            Bug ID: 126977
           Summary: [17 Regression] factor_out_conditional_operation
                    breaks __builtin_crc* handling
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Created attachment 65381
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65381&action=edit
testcase

The attached testcase should compile but on the trunk we get:
<source>: In function 'crc32_data32':
<source>:2:5: error: third argument to 'crc' builtins must be a constant
    2 | int crc32_data32 (unsigned x, unsigned y, int z)
      |     ^~~~~~~~~~~~

This is because for the 3rd operand of the __builtin_crc* __builtin_rev_crc*
builtins is special and need to be a constant.

Noticed while reviewing
https://gcc.gnu.org/pipermail/gcc-patches/2026-August/728405.html .
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.