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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ugh, what a gross usage of a langhook ;)  Its default implementation clearly
doesn't match the use in size_in_bytes:

tree
size_in_bytes_loc (location_t loc, const_tree type)
{
  tree t;

  if (type == error_mark_node)
    return integer_zero_node;

  type = TYPE_MAIN_VARIANT (type);
  t = TYPE_SIZE_UNIT (type);

  if (t == 0)
    {
      lang_hooks.types.incomplete_type_error (loc, NULL_TREE, type);

but the langhook (not sure what the point is in asserting in the no-op
default implementation):

/* Invalid use of an incomplete type.  */
void
lhd_incomplete_type_error (location_t ARG_UNUSED (loc),
                           const_tree ARG_UNUSED (value), const_tree type)
{
  gcc_assert (TREE_CODE (type) == ERROR_MARK);
  return;


OTOH the early out in size_in_bytes means the langhook can never be safely
used or its assert is bogus.  Or the fortran FE messes things up in
unexpected ways (failing to call layout_type on a non-ERROR_MARK type).

Reply via email to