[llvm-commits] [123995] Fix PR1170 and test/CFrontend/2007-02-16-VariableSizeStructArg.c

Duncan Sands baldrick at free.fr
Mon Feb 19 14:55:35 PST 2007


> @@ -108,7 +112,8 @@
>      tree Domain = TYPE_DOMAIN(type);
>      if (!Domain || !TYPE_MIN_VALUE(Domain) || !TYPE_MAX_VALUE(Domain))
>        return 0;
> -    if (TREE_CODE(TYPE_MIN_VALUE(Domain)) != INTEGER_CST ||
> +    if (TREE_CODE(TYPE_SIZE(type)) != INTEGER_CST ||
> +        TREE_CODE(TYPE_MIN_VALUE(Domain)) != INTEGER_CST ||
>          TREE_CODE(TYPE_MAX_VALUE(Domain)) != INTEGER_CST)
>        return 0;
>      if (TREE_INT_CST_LOW(TYPE_MAX_VALUE(Domain)) !=

Is this bit of the patch actually needed?  I can see how it
might be an optimization, in that you detect early if the
array component has non-constant size, and avoid a call to
isSingleElementStructOrArray.  But is it really needed for
correctness?

Thanks,

Duncan.



More information about the llvm-commits mailing list