[Bug target/103271] ICE in assign_stack_temp_for_type with -ftrivial-auto-var-init=pattern and VLAs and -mno-strict-align on riscv64

wilson at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 26 05:08:40 GMT 2021


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

Jim Wilson <wilson at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu.org

--- Comment #5 from Jim Wilson <wilson at gcc dot gnu.org> ---
SiFive doesn't support -mno-strict-align so I've never tested it.  I doubt that
it works correctly, i.e. I doubt that it optimizes as intended.  I've mentioned
this to other RVI members, but there hasn't been anyone other than SiFive
actively working on upstream gcc so I don't think anyone ever looked at it.  It
shouldn't give an ICE though.

Looking at this, it appears to be another "if only we had a movti pattern"
issue.

In expand_DEFERRED_INIT in internal-fn.c, in the reg_lhs == TRUE case, there is
a test
          && have_insn_for (SET, var_mode))
which fails because var_mode is TImode and we don't have a movti pattern.  The
code calls build_zero_cst which returns a constructor with an array type.  We
then call expand_assignment which gets confused as it doesn't know the size of
the array it is copying.

However, if we had a movti pattern, then the code computes the size of the
array, and creates a VIEW_CONVERT_EXPR to document the array size before
calling expand_assignment.  So it looks like it would work if we had a movti
pattern.

I verified that adding a dummy movti pattern makes the ICE go away.


More information about the Gcc-bugs mailing list