On 8/19/19 7:57 AM, Richard Biener wrote:
+static tree
+objsize_from_type (tree object)
+{
+ if (TREE_CODE (object) != ADDR_EXPR)
+ return NULL_TREE;
+
+ tree type = TREE_TYPE (object);
+ if (POINTER_TYPE_P (type))
that if looks suspicious... I'd say
if (!POINTER_TYPE_P (type))
return NULL_TREE;
is better
Sure. But we may not be able to use this anyway as you noted later,
depending on the type is not safe.
+ type = TREE_TYPE (type);
+ if (TREE_CODE (type) == ARRAY_TYPE && !array_at_struct_end_p (object))
+ {
array_at_struct_end_p will never return true here since you pass it
an ADDR_EXPR... you wanted to pass TREE_OPERAND (object, 0) here?
I think you're right. Given this was cribbed from the tail of another
function elsewhere, I suspect that other function has the same issue.
I suspect ultimately we want to fix that other copy and drop
objsize_from_type.