diff options
Diffstat (limited to 'gcc/fortran/trans.c')
-rw-r--r-- | gcc/fortran/trans.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 0ee8459..a3c3ddc 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -650,9 +650,6 @@ gfc_trans_code (gfc_code * code) void gfc_generate_code (gfc_namespace * ns) { - gfc_symbol *main_program = NULL; - symbol_attribute attr; - if (ns->is_block_data) { gfc_generate_block_data (ns); @@ -662,6 +659,9 @@ gfc_generate_code (gfc_namespace * ns) /* Main program subroutine. */ if (!ns->proc_name) { + gfc_symbol *main_program; + symbol_attribute attr; + /* Lots of things get upset if a subroutine doesn't have a symbol, so we make one now. Hopefully we've set all the required fields. */ gfc_get_symbol ("MAIN__", ns, &main_program); @@ -670,7 +670,9 @@ gfc_generate_code (gfc_namespace * ns) attr.proc = PROC_UNKNOWN; attr.subroutine = 1; attr.access = ACCESS_PUBLIC; + attr.is_main_program = 1; main_program->attr = attr; + /* Set the location to the first line of code. */ if (ns->code) main_program->declared_at = ns->code->loc; |