File gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch of Package gdb.28855

[gdb/testsuite] Workaround unnecessary .s file with gfortran 4.8

After running test-case gdb.fortran/namelist.exp with gfortran 4.8.5, I'm left
with:
...
$ git sti
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        gdb/testsuite/lib/compiler.s

nothing added to commit but untracked files present (use "git add" to track)
...

We're running into PR gcc/60447, which was fixed in gcc 4.9.0.

Workaround this by first copying the source file to the temp dir, such that
the .s file is left there instead:
...
$ ls build/gdb/testsuite/temp/<runtest pid>/
compiler.c  compiler.F90  compiler.s
...

Tested on x86_64-linux.

---
 gdb/testsuite/lib/gdb.exp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6f6acfe188a..f8cd2292170 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4087,6 +4087,12 @@ proc get_compiler_info {{arg ""}} {
 	set cppout [read $file]
 	close $file
     } else {
+	# Copy $ifile to temp dir, to work around PR gcc/60447.  This will leave the
+	# superfluous .s file in the temp dir instead of in the source dir.
+	set tofile [file tail $ifile]
+	set tofile [standard_temp_file $tofile]
+	file copy -force $ifile $tofile
+	set ifile $tofile
 	set cppout [ gdb_compile "${ifile}" "" preprocess [list "$arg" quiet getting_compiler_info] ]
     }
     eval log_file $saved_log
openSUSE Build Service is sponsored by