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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 43098
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43098&action=edit
gcc8-pr83590.patch

Actually, the problem is much more severe.  The thing is, neither the
TYPE_SIZE_UNIT nor DECL_SIZE_UNIT is INTEGER_CST from the FE, it becomes
INTEGER_CST when gimplify_one_sizepos is called on these.  First we gimplify
the TYPE_SIZE*, then check DECL_SIZE* for not being INTEGER_CST and then we
gimplify DECL_SIZE*, at which point it becomes also INTEGER_CST.  But we are
already determined to treat it as VLA and create DECL_VALUE_EXPR for it.  Of
course all the OpenMP/OpenACC lowering/expansion code checks for special
treatment of VLA by checking either DECL_SIZE* or TYPE_SIZE* or
variably_modified*, but none of these are true.  So, either we can do what this
patch does, or we'd need to introduce some flag whether gimplify_vla_decl has
been done on it (parsing DECL_VALUE_EXPR and trying to understand if it is due
to being VLA or myriads of other reasons why it has DECL_VALUE_EXPR is too
hard).

Can you give this a spin?

Reply via email to