This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] PATCH ping*5 darwin undefined references to _environ


Hi,
I am getting a little bored with pinging this.

On darwin, GNU libtool fails it's tests when using gfortran, this is due to libgfortran.dylib having undefined references to _environ. When attempting to link a two level namespace library (the default) using gfortran, the link fails citing the undefined references to _environ.

The code affected is not actually used in gfortran itself and was put in for debugging purposes. This patch removes the code that references environ because my patch to fix this by using crt_externs.h was rejected on the grounds that the code is actually unused!

This bug is a regression and the patch should be applied to both mainline and the gcc-4.0 branch.

Is this patch okay?

Peter
--
Peter O'Gorman - http://www.pogma.com
Index: ChangeLog
2005-02-25  Peter O'Gorman  <peter@pogma.com>

	PR libgfortran/17748
	* runtime/environ.c: Remove references to environ.
	(show_variables): remove GFORTRAN_UNBUFFERED_* and 
	GFORTRAN_NAME_* because they require environ.
	(pattern_scan): Remove function.

from  Paul Thomas <paulthomas2@wannado.fr>
Index: runtime/environ.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/runtime/environ.c,v
retrieving revision 1.7
diff -u -3 -p -u -r1.7 environ.c
--- runtime/environ.c 23 Jan 2005 00:14:31 -0000 1.7
+++ runtime/environ.c 25 Feb 2005 14:46:46 -0000
@@ -48,7 +48,6 @@ Boston, MA 02111-1307, USA.  */
 
 options_t options = { };
 
-extern char **environ;
 
 typedef struct variable
 {
@@ -464,12 +463,6 @@ static variable variable_table[] = {
   {"GFORTRAN_SHOW_LOCUS", 1, &options.locus, init_boolean, show_boolean,
    "If TRUE, print filename and line number where runtime errors happen."},
 
-/* GFORTRAN_NAME_xx (where xx is a unit number) gives the names of files
- * preconnected to those units. */
-
-/* GFORTRAN_UNBUFFERED_xx (where xx is a unit number) gives a boolean that is used
- * to turn off buffering for that unit. */
-
   {"GFORTRAN_OPTIONAL_PLUS", 0, &options.optional_plus, init_boolean, show_boolean,
    "Print optional plus signs in numbers where permitted.  Default FALSE."},
 
@@ -577,43 +570,9 @@ check_buffered (int n)
 }
 
 
-/* pattern_scan()-- Given an environment string, check that the name
- * has the same name as the pattern followed by an integer.  On a
- * match, a pointer to the value is returned and the integer pointed
- * to by n is updated.  Returns NULL on no match. */
-
-static char *
-pattern_scan (char *env, const char *pattern, int *n)
-{
-  char *p;
-  size_t len;
-
-  len = strlen (pattern);
-  if (strncasecmp (env, pattern, len) != 0)
-    return NULL;
-  p = env + len;
-
-  if (!isdigit (*p))
-    return NULL;
-
-  while (isdigit (*p))
-    p++;
-
-  if (*p != '=')
-    return NULL;
-
-  *p = '\0';
-  *n = atoi (env + len);
-  *p++ = '=';
-
-  return p;
-}
-
-
 void
 show_variables (void)
 {
-  char *p, **e;
   variable *v;
   int n;
 
@@ -640,26 +599,6 @@ show_variables (void)
       st_printf ("%s\n\n", v->desc);
     }
 
-  st_printf ("\nDefault unit names (GFORTRAN_NAME_x):\n");
-
-  for (e = environ; *e; e++)
-    {
-      p = pattern_scan (*e, "GFORTRAN_NAME_", &n);
-      if (p == NULL)
-	continue;
-      st_printf ("GFORTRAN_NAME_%d         %s\n", n, p);
-    }
-
-  st_printf ("\nUnit buffering overrides (GFORTRAN_UNBUFFERED_x):\n");
-  for (e = environ; *e; e++)
-    {
-      p = pattern_scan (*e, "GFORTRAN_UNBUFFERED_", &n);
-      if (p == NULL)
-	continue;
-
-      st_printf ("GFORTRAN_UNBUFFERED_%d = %s\n", n, p);
-    }
-
   /* System error codes */
 
   st_printf ("\nRuntime error codes:");

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]