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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is caused by the:
278098     msebor         if ((RECORD_OR_UNION_TYPE_P (xtype)
278098     msebor              && field_at_offset (xtype, *off, &index))
278098     msebor             || (TREE_CODE (xtype) == ARRAY_TYPE
278098     msebor                 && TREE_CODE (TREE_TYPE (xtype)) ==
ARRAY_TYPE
278098     msebor                 && array_elt_at_offset (xtype, *off,
&index)))
278098     msebor           {
278098     msebor             *fldoff += index;
278098     msebor             *off -= index;
278098     msebor             fldoff = NULL;
278098     msebor           }
278098     msebor       }
278098     msebor 
278098     msebor       return get_origin_and_offset (x, fldoff, NULL);

get_origin_and_offset assumes that fldoff is never NULL.
If the intent that writes to *fldoff from the recursive call should be ignored,
then perhaps it can do say:
  index = 0;
  fldoff = &index;
instead of fldoff = NULL; or perhaps
        else if (idx < HOST_WIDE_INT_MAX)
          *fldoff += idx * int_size_in_bytes (eltype);
        else
          *fldoff = idx;
should be
        else if (fldoff)
          {
            if (idx < HOST_WIDE_INT_MAX)
              *fldoff += idx * int_size_in_bytes (eltype);
            else
              *fldoff = idx;
          }
But, it isn't obvious what this function is meant for at all, so while either
one would fix the ICE, it is unclear what the right thing is.

Reply via email to