flang
flang copied to clipboard
Add more checkings for derived types in COMMON statements
This patch fixes two problems:
- When two or more
COMMON
blocks with the same name have objects with default initialization, flang will execute each initialization more than once. The first pass will carry out normally, whereas the others will be rejected in thewrite_comm
function, leaving theDSRT
pointer un-nullified, ultimately causing a segmentation fault. - If a common-block-object is of a derived type, the type shall have the BIND attribute or the SEQUENCE attribute and it shall have no default initialization. A common-block-object shall not be a derived-type object with an ultimate component that is allocatable. flang fails to enforce the above restrictions on derived types.
This patch fixes the 2 problems above by setting DSRT
to NULL
at the right time and capturing/reporting the aforementioned
syntactical error.
@qiaozhang-hnc Could you rebase this branch please?
@qiaozhang-hnc Could you rebase this branch please?
Rebased.