bsc-pm / mcxx

Mercurium is a C/C++/Fortran source-to-source compilation infrastructure aimed at fast prototyping developed by the Programming Models group at the Barcelona Supercomputing Center
GNU Lesser General Public License v3.0
69 stars 23 forks source link

TARGET statement is not handling array-spec correctly #5

Closed rofirrim closed 6 years ago

rofirrim commented 6 years ago

The following valid code

PROGRAM MAIN
    IMPLICIT NONE
    INTEGER  :: Y
    TARGET :: Y(10)

    Y(1) = 3
END PROGRAM MAIN

crashes because when handling the AST_DIMENSION_DECL we try to query the name in the wrong tree in function build_scope_target_stmt

for_each_element(target_decl_list, it)
    {
        AST target_decl = ASTSon1(it);

        AST name = target_decl;

        /* ERROR */ scope_entry_t* entry = get_symbol_for_name(decl_context, name, ASTText(name));

        if (ASTKind(target_decl_list) == AST_DIMENSION_DECL)