[Bug libgomp/28725] New: Case Sensitive OpenMP environment variables and patch

merz at cita dot utoronto dot ca gcc-bugzilla@gcc.gnu.org
Mon Aug 14 14:52:00 GMT 2006


The OpenMP 2.5 specification states that "The values assigned to the
environment variables are case insensitive and may have leading and trailing
white space." 

As of the 4.2-20060805 snapshot only lower case is accepted, ie:

#setenv OMP_NESTED TRUE
#./a.out 
libgomp: Invalid value for environment variable OMP_NESTED

The following patch uses strcasecmp instead of strcmp to check the value of
boolean environment variables in libgomp/env.c: 

--- gcc-4.2-20060805.orig/libgomp/env.c 2006-08-11 22:06:52.000000000 -0400
+++ gcc-4.2-20060805/libgomp/env.c      2006-08-11 22:08:07.000000000 -0400
@@ -140,9 +140,9 @@
   if (env == NULL)
     return;

-  if (strcmp (env, "true") == 0)
+  if (strcasecmp (env, "true") == 0)
     *value = true;
-  else if (strcmp (env, "false") == 0)
+  else if (strcasecmp (env, "false") == 0)
     *value = false;
   else
     gomp_error ("Invalid value for environment variable %s", name);


-- 
           Summary: Case Sensitive OpenMP environment variables and patch
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: merz at cita dot utoronto dot ca


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28725



More information about the Gcc-bugs mailing list