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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |14.0
           Keywords|                            |wrong-code
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
alias.c does

  /* See if the language has special handling for this type.  */
  set = lang_hooks.get_alias_set (t);
  if (set != -1)
    return set;

  /* There are no objects of FUNCTION_TYPE, so there's no point in
     using up an alias set for them.  (There are, of course, pointers
     and references to functions, but that's different.)  */
  else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE)
    set = 0;

but when handling pointer-to-function we simply create a new alias-set
for each distinct (according to TYPE_CANONICAL (TYPE_MAIN_VARIANT ())))
pointed-to type.

It's going to be difficult to canonicalize return and argument types
here, so the answer is probably tree.cc:maybe_canonicalize_argtypes
and thus reflecting this in the TYPE_CANONICAL of the function type.

Note this is also how we handle pointer to structure types, but as
structures are real objects those already have TYPE_CANONICAL set up
appropriately.  So I wonder whether the C frontend doesn't need to do
the same for FUNCTION_TYPEs rather than putting the burden on the
middle-end here?

Reply via email to