OSDN Git Service

* c-common.c, c-parser.c, cfgbuild.c, cfghooks.c, cfghooks.h,
[pf3gnuchains/gcc-fork.git] / gcc / fortran / trans.c
index 7526c02..70630cb 100644 (file)
@@ -1,5 +1,5 @@
 /* Code translation -- generate GCC trees from gfc_code.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by Paul Brook
 
 This file is part of GCC.
@@ -24,12 +24,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "coretypes.h"
 #include "tree.h"
 #include "tree-gimple.h"
-#include <stdio.h>
 #include "ggc.h"
 #include "toplev.h"
 #include "defaults.h"
 #include "real.h"
-#include <gmp.h>
 #include "gfortran.h"
 #include "trans.h"
 #include "trans-stmt.h"
@@ -127,7 +125,7 @@ gfc_evaluate_now (tree expr, stmtblock_t * pblock)
 {
   tree var;
 
-  if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c')
+  if (CONSTANT_CLASS_P (expr))
     return expr;
 
   var = gfc_create_var (TREE_TYPE (expr), NULL);
@@ -154,13 +152,13 @@ gfc_add_modify_expr (stmtblock_t * pblock, tree lhs, tree rhs)
              || AGGREGATE_TYPE_P (TREE_TYPE (lhs)));
 #endif
 
-  tmp = fold (build2_v (MODIFY_EXPR, lhs, rhs));
+  tmp = fold_build2 (MODIFY_EXPR, void_type_node, lhs, rhs);
   gfc_add_expr_to_block (pblock, tmp);
 }
 
 
 /* Create a new scope/binding level and initialize a block.  Care must be
-   taken when translating expessions as any temporaries will be placed in
+   taken when translating expressions as any temporaries will be placed in
    the innermost scope.  */
 
 void
@@ -439,7 +437,7 @@ gfc_get_backend_locus (locus * loc)
 {
   loc->lb = gfc_getmem (sizeof (gfc_linebuf));    
 #ifdef USE_MAPPED_LOCATION
-  loc->lb->location = input_location; // FIXME adjust??
+  loc->lb->location = input_location; /* FIXME adjust?? */
 #else
   loc->lb->linenum = input_line - 1;
 #endif
@@ -479,8 +477,6 @@ gfc_trans_code (gfc_code * code)
      the end of this gfc_code branch.  */
   for (; code; code = code->next)
     {
-      gfc_set_backend_locus (&code->loc);
-
       if (code->here != 0)
        {
          res = gfc_trans_label_here (code);
@@ -625,14 +621,16 @@ gfc_trans_code (gfc_code * code)
          internal_error ("gfc_trans_code(): Bad statement code");
        }
 
+      gfc_set_backend_locus (&code->loc);
+
       if (res != NULL_TREE && ! IS_EMPTY_STMT (res))
        {
          if (TREE_CODE (res) == STATEMENT_LIST)
            annotate_all_with_locus (&res, input_location);
          else
            SET_EXPR_LOCATION (res, input_location);
-
-         /* Add the new statemment to the block.  */
+           
+         /* Add the new statement to the block.  */
          gfc_add_expr_to_block (&block, res);
        }
     }