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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
          Component|fortran                     |tree-optimization
           Keywords|                            |ice-checking,
                   |                            |ice-on-valid-code

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We are folding

 __builtin_memcpy (&transfer.0, &b, 1);

to

  _12 = BIT_FIELD_REF <b_13(D), 8, 0>;
  MEM[(c_char * {ref-all})&transfer.0] = _12;

where update_address_taken rewrites

  _12 = MEM[(c_char * {ref-all}&b];

to the BIT_FIELD_REF, exactly because the memory reference
references QImode but the variable has HImode so we cannot use
a VIEW_CONVERT to pun.

The logic in update-address-taken doesn't match that of the verifier here,
the variable is

 <var_decl 0x7ffff6523cf0 b
    type <boolean_type 0x7ffff653e0a8 logical(kind=2) public unsigned HI
        size <integer_cst 0x7ffff6517dc8 constant 16>
        unit-size <integer_cst 0x7ffff6517de0 constant 2>
        align:16 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff653e0a8 precision:1 min <integer_cst 0x7ffff6539180 0> max <integer_cst
0x7ffff65391b0 1>
        pointer_to_this <pointer_type 0x7ffff670cb28>>
    used unsigned HI t.f90:3:18 size <integer_cst 0x7ffff6517dc8 16> unit-size
<integer_cst 0x7ffff6517de0 2>
    align:16 warn_if_not_align:0 context <function_decl 0x7ffff670e500 s>>

the intent of the verifier is to avoid the need to deal with referencing
padding in registers.  I'm not sure we absolutely have to uphold that
but a workaround would be to V_C_E the non-mode-precision operand to
a mode-precision operand and perform the BIT_FIELD_REF on that instead.
Note we don't seem to have any issue with non-integral typed non-mode-precision
operands here which is a bit inconsistent.

That was changed with the fix for PR88739.

Reply via email to