Patch (contains also a different patch, I'm to lazy to separate): The missing argument check is not needed as this is already checked for in gcc/fortran/gfortranspec.c. OPT_M is not needed as -M is changed into -J.
Index: gcc/fortran/gfortranspec.c =================================================================== --- gcc/fortran/gfortranspec.c (revision 131933) +++ gcc/fortran/gfortranspec.c (working copy) @@ -89,6 +89,7 @@ OPTION_E, /* Aka --preprocess. */ OPTION_help, /* --help. */ OPTION_i, /* -imacros, -include, -include-*. */ + OPTION_J, OPTION_l, OPTION_L, /* Aka --library-directory. */ OPTION_nostdlib, /* Aka --no-standard-libraries, or @@ -160,6 +161,8 @@ opt = OPTION_E, skip = 0; else if (text[1] == 'i') opt = OPTION_i, skip = 0; + else if (text[1] == 'J') + opt = OPTION_J, skip = (text[2] == '\0'), arg = text + 2; else if (text[1] == 'l') opt = OPTION_l; else if (text[1] == 'L') @@ -368,6 +371,7 @@ case OPTION_b: case OPTION_B: case OPTION_L: + case OPTION_J: case OPTION_i: case OPTION_V: /* These options are useful in conjunction with -v to get @@ -426,7 +430,9 @@ { char *p; - if (argv[i][2] == '\0') + fprintf (stderr, _("Warning: Using -M mod_path is deprecated, " + "use -J instead\n")); + if (argv[i][2] == '\0' && i+1 < argc) { p = XNEWVEC (char, strlen (argv[i + 1]) + 2); p[0] = '-'; @@ -437,12 +443,31 @@ else { p = XNEWVEC (char, strlen (argv[i]) + 1); - strcpy (p, argv[i]); + p[0] = '-'; + p[1] = 'J'; + strcpy (&p[2], argv[i]); } append_arg (p); continue; } + if ((argv[i][0] == '-') && (argv[i][1] == 'J')) + { + if (argv[i][2] == '\0' && i+1 < argc) + { + char *p; + p = XNEWVEC (char, strlen (argv[i + 1]) + 2); + p[0] = '-'; + p[1] = 'J'; + strcpy (&p[2], argv[i + 1]); + i++; + append_arg (p); + } + else + append_arg (argv[i]); + continue; + } + if ((argv[i][0] == '-') && (argv[i][1] != 'l')) { /* Not a filename or library. */ Index: gcc/fortran/options.c =================================================================== --- gcc/fortran/options.c (revision 131933) +++ gcc/fortran/options.c (working copy) @@ -389,13 +389,7 @@ if (gfc_option.module_dir != NULL) { - gfc_status ("gfortran: Only one -M option allowed\n"); - exit (3); - } - - if (arg == NULL) - { - gfc_status ("gfortran: Directory required after -M\n"); + gfc_status ("gfortran: Only one -J option allowed\n"); exit (3); } @@ -717,7 +711,6 @@ break; case OPT_J: - case OPT_M: gfc_handle_module_path_options (arg); break; -- Summary: Gfortran does not support "-J <dir>" only "-J<dir>" Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35019