Hi all, this patch fixes a bunch of issues with CLASS. * * * Side remark: I disliked the way CLASS is represented when it was introduced; when writing the testcase for this PR and kept fixing the testcase fallout, I started to hate it! I am sure that there are more issues – but I tried hard not too look closer at surrounding code to avoid hitting more issues. (If you look for a project, I think if you put attributes on separate lines, like a separate "POINTER :: var" line, you have a high chance to hit the error.) * * * What I found rather puzzling is that the 'optional' argument could be either on sym->attr.optional or on CLASS_DATA (sym)->attr.optional. I think one occurs for 'foo2' and the other for 'foo4' - not that I understand why it differs. I think it is otherwise straight forward. Regarding the original issue: In order to detect an assumed-size argument to an assumed-rank array, the last dimension has 'ubound = -1' to indicate an assume-size array; for those size(x, dim=rank(x)-1) == -1 and size(x) < 0 However, when the dummy argument (and hence: actual argument) is either a pointer or an allocatable, the bound is passed as is (in particular, "-1" is a valid ubound and size(x) >= 0). – However, if the actual argument is unallocated/not associated, rank(var) still is supposed to work - hence, it has to be set. The last two items did work before - but not for CLASS -> CLASS. Additionally, the ubound = -1 had an issue for CLASS -> TYPE as the code assumed that expr->ref is the whole array ("var(full-array-ref)") but for CLASS the expr->ref is a component and only expr->ref->next is the array ref. ("var%_data(full-array-ref)"). OK for mainline? Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955