OSDN Git Service

PR middle-end/40815
[pf3gnuchains/gcc-fork.git] / gcc / fortran / options.c
index d2c6d9b..bcbf695 100644 (file)
@@ -1,5 +1,6 @@
 /* Parse and display command line options.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+   2009, 2010
    Free Software Foundation, Inc.
    Contributed by Andy Vaught
 
@@ -125,12 +126,11 @@ gfc_init_options (unsigned int argc, const char **argv)
   gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
   gfc_option.flag_init_character_value = (char)0;
   gfc_option.flag_align_commons = 1;
+  gfc_option.flag_protect_parens = 1;
   
   gfc_option.fpe = 0;
   gfc_option.rtcheck = 0;
-
-  /* Argument pointers cannot point to anything but their argument.  */
-  flag_argument_noalias = 3;
+  gfc_option.coarray = GFC_FCOARRAY_NONE;
 
   flag_errno_math = 0;
 
@@ -242,27 +242,9 @@ gfc_post_options (const char **pfilename)
   if (flag_whole_program)
     gfc_option.flag_whole_file = 1;
 
+  /* Enable whole-file mode if LTO is in effect.  */
   if (flag_lto || flag_whopr)
-    {
-#ifdef ENABLE_LTO
-      flag_generate_lto = 1;
-
-      /* When generating IL, do not operate in whole-program mode.
-        Otherwise, symbols will be privatized too early, causing link
-        errors later.  */
-      flag_whole_program = 0;
-
-      /* But do enable whole-file mode.  */
-      gfc_option.flag_whole_file = 1;
-#else
-      error ("LTO support has not been enabled in this configuration");
-#endif
-    }
-
-  /* Reconcile -flto and -fwhopr.  Set additional flags as appropriate and
-     check option consistency.  */
-  if (flag_lto && flag_whopr)
-    error ("-flto and -fwhopr are mutually exclusive");
+    gfc_option.flag_whole_file = 1;
 
   /* -fbounds-check is equivalent to -fcheck=bounds */
   if (flag_bounds_check)
@@ -371,18 +353,22 @@ gfc_post_options (const char **pfilename)
                     "implied by -fopenmp", 
                     gfc_option.flag_max_stack_var_size);
 
-  /* Implied -frecursive; implemented as -fmax-stack-var-size=-1.  */
-  if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp)
+  /* Implement -frecursive as -fmax-stack-var-size=-1.  */
+  if (gfc_option.flag_recursive)
     gfc_option.flag_max_stack_var_size = -1;
 
+  /* Implied -frecursive; implemented as -fmax-stack-var-size=-1.  */
+  if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp
+      && gfc_option.flag_automatic)
+    {
+      gfc_option.flag_recursive = 1;
+      gfc_option.flag_max_stack_var_size = -1;
+    }
+
   /* Set default.  */
   if (gfc_option.flag_max_stack_var_size == -2)
     gfc_option.flag_max_stack_var_size = 32768;
 
-  /* Implement -frecursive as -fmax-stack-var-size=-1.  */
-  if (gfc_option.flag_recursive)
-    gfc_option.flag_max_stack_var_size = -1;
-
   /* Implement -fno-automatic as -fmax-stack-var-size=0.  */
   if (!gfc_option.flag_automatic)
     gfc_option.flag_max_stack_var_size = 0;
@@ -492,15 +478,28 @@ gfc_handle_fpe_trap_option (const char *arg)
 
 
 static void
+gfc_handle_coarray_option (const char *arg)
+{
+  if (strcmp (arg, "none") == 0)
+    gfc_option.coarray = GFC_FCOARRAY_NONE;
+  else if (strcmp (arg, "single") == 0)
+    gfc_option.coarray = GFC_FCOARRAY_SINGLE;
+  else
+    gfc_fatal_error ("Argument to -fcoarray is not valid: %s", arg);
+}
+
+
+static void
 gfc_handle_runtime_check_option (const char *arg)
 {
   int result, pos = 0, n;
   static const char * const optname[] = { "all", "bounds", "array-temps",
-                                         "recursion", "do", "pointer", NULL };
+                                         "recursion", "do", "pointer",
+                                         "mem", NULL };
   static const int optmask[] = { GFC_RTCHECK_ALL, GFC_RTCHECK_BOUNDS,
                                 GFC_RTCHECK_ARRAY_TEMPS,
                                 GFC_RTCHECK_RECURSION, GFC_RTCHECK_DO,
-                                GFC_RTCHECK_POINTER,
+                                GFC_RTCHECK_POINTER, GFC_RTCHECK_MEM,
                                 0 };
  
   while (*arg)
@@ -579,6 +578,10 @@ gfc_handle_option (size_t scode, const char *arg, int value)
       gfc_option.warn_implicit_interface = value;
       break;
 
+    case OPT_Wimplicit_procedure:
+      gfc_option.warn_implicit_procedure = value;
+      break;
+
     case OPT_Wline_truncation:
       gfc_option.warn_line_truncation = value;
       break;
@@ -930,10 +933,17 @@ gfc_handle_option (size_t scode, const char *arg, int value)
       gfc_option.flag_align_commons = value;
       break;
 
+    case OPT_fprotect_parens:
+      gfc_option.flag_protect_parens = value;
+      break;
+
     case OPT_fcheck_:
       gfc_handle_runtime_check_option (arg);
       break;
 
+    case OPT_fcoarray_:
+      gfc_handle_coarray_option (arg);
+      break;
     }
 
   return result;