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

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

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I never said there is a bug in the C FE, I think the testcases just make
invalid assumptions.
In any case, the change that matters here is likely my r254930 or r255285, and
one could do something like add say:
  && (ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (decl)))
      || !AGGREGATE_TYPE_P (TREE_TYPE (decl)))
to decl_constant_value_1 conditions to prevent it from looking at aggregate
initializers in non-generic address spaces.
Perhaps there should be also some cap on the size of decl that is optimized
regardless of the address space, e.g. 7.x and earlier had:
      || TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
      || DECL_MODE (exp) == BLKmode)
condition to punt.  Now, sometimes it is beneficial to have even BLKmode or
array decls to go through, say if we have str[5], similarly
const_var.field,then not punting on those will allow it to be optimized into
constant, while 7.x couldn't.  But, with something large and non-constant
access it might actually regress (duplicate the constant).

Reply via email to