[PATCH, Fortran] Fix execution tests on simulator

Adam Nemet anemet@caviumnetworks.com
Tue Dec 2 17:26:00 GMT 2008


As was discussed recently the simulator does not set argv[0].  All Fortran
execution tests fail currently when store_exe_path tries to extract the path
from argv[0].  The patch below fixes the crash and produces 7488 more passes:

-# of expected passes		15855
-# of unexpected failures	9465
+# of expected passes		23559
+# of unexpected failures	1977

Tested with mipsisa64r2-elf.

OK to install?

Adam

	* runtime/main.c (store_exe_path): Don't crash if argv0 is NULL.

Index: main.c
===================================================================
--- main.c	(revision 142342)
+++ main.c	(working copy)
@@ -111,7 +111,8 @@ store_exe_path (const char * argv0)
 
   char buf[PATH_MAX], *cwd, *path;
 
-  if (argv0[0] == '/')
+  /* On the simulator argv is not set.  */
+  if (argv0 == NULL || argv0[0] == '/')
     {
       exe_path = argv0;
       please_free_exe_path_when_done = 0;



More information about the Gcc-patches mailing list