Hi all,

As reported in the PR we can end up calling fclose twice on a file, causing an 
error.
This patch fixes that by reorganising the logic a bit to ensure we return after 
closing
the file the first time.

Bootstrapped and tested on arm-none-linux-gnueabihf

Ok for trunk?

Thanks,
Kyrill

2016-03-11  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

    PR driver/70132
    * config/arm/driver-arm.c (host_detect_local_cpu): Set file pointer
    to NULL after closing file.
diff --git a/gcc/config/arm/driver-arm.c b/gcc/config/arm/driver-arm.c
index 466743b9d47f4144b6aade23e3f311405736ffa2..95dc9d53b6c179946d62f45b2b0d4a21960405b8 100644
--- a/gcc/config/arm/driver-arm.c
+++ b/gcc/config/arm/driver-arm.c
@@ -128,12 +128,11 @@ host_detect_local_cpu (int argc, const char **argv)
 	}
     }
 
-  fclose (f);
-
-  if (val == NULL)
-    goto not_found;
-
-  return concat ("-m", argv[0], "=", val, NULL);
+  if (val)
+    {
+      fclose (f);
+      return concat ("-m", argv[0], "=", val, NULL);
+     }
 
 not_found:
   {

Reply via email to