Am 27.03.2013 10:47, schrieb Thomas Koenig:
I think you need to deallocate array_size in gfc_simplify_sizeof
unconditionally.
Actually, when I applied the more than two years old draft patch, I
thought likewise - but that leads to segfaults. If one reads the code
more carefully, one sees that the condition is required:
+ if (x->rank && x->expr_type != EXPR_ARRAY
+ && gfc_array_size (x, &array_size) == FAILURE)
+ return NULL;
Here, it is allocated on success of gfc_array_size.
But only if "x->rank && x->expr_type != EXPR_ARRAY" is true.
And here, it is freed only if expr_type != EXPR_ARRAY.
+ if (x->rank && x->expr_type != EXPR_ARRAY)
Which is the same condition.
I have now applied the (unmodified) patch as Rev. 197159.
Thanks for the review!
Tobias