01917d
commit 77c365df78441f7b968ec0f62c7ed9f5de36dc60
01917d
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
01917d
Date:   Mon Aug 24 15:37:40 2015 +0200
01917d
01917d
    gnu_vector.exp: Avoid some more known FAILs
01917d
    
01917d
    This avoids two more types of FAILs with the gnu_vector test case.
01917d
    
01917d
    First, for POWER targets newer GCCs emit an ABI note when invoked with
01917d
    "-mcpu=native".  Then the test case fell back to non-native compile,
01917d
    producing code for a non-vector ABI.  But that is not supported by GDB.
01917d
    Thus the compiler note is now suppressed with "-Wno-psabi".
01917d
    
01917d
    Second, on s390 the test case produced FAILs after falling back to a
01917d
    non-vector ABI when using "finish" or "return" in a vector-valued
01917d
    function.  This was due to a long-standing known bug (Bug 8549).  This
01917d
    case is now detected, and KFAILs are emitted instead.
01917d
    
01917d
    gdb/testsuite/ChangeLog:
01917d
    
01917d
    	* gdb.base/gnu_vector.exp: Try compilation with "-mcpu=native
01917d
    	-Wno-psabi" if "-mcpu=native" fails.  For the tests with "finish"
01917d
    	and "return" use KFAIL when GDB can not read/write the vector
01917d
    	return value.
01917d
01917d
### a/gdb/testsuite/ChangeLog
01917d
### b/gdb/testsuite/ChangeLog
01917d
## -1,3 +1,10 @@
01917d
+2015-08-24  Andreas Arnez  <arnez@linux.vnet.ibm.com>
01917d
+
01917d
+	* gdb.base/gnu_vector.exp: Try compilation with "-mcpu=native
01917d
+	-Wno-psabi" if "-mcpu=native" fails.  For the tests with "finish"
01917d
+	and "return" use KFAIL when GDB can not read/write the vector
01917d
+	return value.
01917d
+
01917d
 2015-08-21  Gary Benson <gbenson@redhat.com>
01917d
 
01917d
 	* gdb.trace/pending.exp: Cope with remote transfer warnings.
01917d
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
01917d
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
01917d
@@ -25,11 +25,19 @@ standard_testfile .c
01917d
 # without a CPU option.  If all variants fail, assume that the
01917d
 # compiler can not handle GNU vectors.
01917d
 
01917d
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug quiet additional_flags=-mcpu=native}] != ""
01917d
-     && [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug quiet additional_flags=-march=native}] != ""
01917d
-     && [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug quiet}] != ""} {
01917d
-    untested "compiler can't handle the vector_size attribute?"
01917d
-    return -1
01917d
+proc do_compile { {opts {}} } {
01917d
+    global srcdir subdir srcfile binfile
01917d
+    set ccopts {debug quiet}
01917d
+    foreach opt $opts {lappend ccopts "additional_flags=$opt"}
01917d
+    gdb_compile "${srcdir}/${subdir}/${srcfile}" "$binfile" executable $ccopts
01917d
+}
01917d
+
01917d
+if { [do_compile {-mcpu=native}] != ""
01917d
+     && [do_compile {-mcpu=native -Wno-psabi}] != ""
01917d
+     && [do_compile {-march=native}] != ""
01917d
+     && [do_compile] != ""} {
01917d
+	untested "compiler can't handle vector_size attribute?"
01917d
+	return -1
01917d
 }
01917d
 
01917d
 clean_restart ${binfile}
01917d
@@ -195,14 +203,46 @@ gdb_test "print add_structvecs(i2, (struct just_int2)\{2*i2\}, (struct two_int2)
01917d
 gdb_test "print add_singlevecs((char1) \{6\}, (int1) \{12\}, (double1) \{24\})" "= \\{42\\}" \
01917d
     "call add_singlevecs"
01917d
 
01917d
-# Test vector return value handling with "finish" and "return".
01917d
+# Test "finish" from vector-valued function.
01917d
 gdb_breakpoint "add_some_intvecs"
01917d
 gdb_continue "add_some_intvecs"
01917d
-gdb_test "finish" "Value returned is .* = \\{10, 20, 48, 72\\}" \
01917d
-    "finish shows vector return value"
01917d
+set test "finish shows vector return value"
01917d
+gdb_test_multiple "finish" $test {
01917d
+    -re "Value returned is .* = \\{10, 20, 48, 72\\}.*$gdb_prompt $" {
01917d
+	pass $test
01917d
+    }
01917d
+    -re "Value returned has type: .* Cannot determine contents.*$gdb_prompt $" {
01917d
+	kfail "gdb/8549" $test
01917d
+    }
01917d
+}
01917d
+
01917d
+# Test "return" from vector-valued function.
01917d
 gdb_continue "add_some_intvecs"
01917d
-gdb_test "return (int4) \{4, 2, 7, 6\}" \
01917d
-    "#0 .* main .*" \
01917d
-    "set vector return value" \
01917d
-    "Make add_some_intvecs return now. .y or n.*" "y"
01917d
-gdb_test "continue" "4 2 7 6\r\n.*" "verify vector return value"
01917d
+set test "return from vector-valued function"
01917d
+set should_kfail 0
01917d
+gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test {
01917d
+    -re "#0 .* main .*$gdb_prompt $" {
01917d
+	pass $test
01917d
+    }
01917d
+    -re "The location .* is unknown.\r\n.* return value .* will be ignored.\r\n" {
01917d
+	set should_kfail 1
01917d
+	exp_continue
01917d
+    }
01917d
+    -re "Make add_some_intvecs return now. .y or n. $" {
01917d
+	send_gdb "y\n"
01917d
+	exp_continue
01917d
+    }
01917d
+}
01917d
+set test "verify vector return value"
01917d
+gdb_test_multiple "continue" $test {
01917d
+    -re "4 2 7 6\r\n.*$gdb_prompt $" {
01917d
+	pass $test
01917d
+    }
01917d
+    -re "10 20 48 72\r\n.*$gdb_prompt $" {
01917d
+	if { $should_kfail } {
01917d
+	    kfail "gdb/8549" $test
01917d
+	} else {
01917d
+	    fail $test
01917d
+	}
01917d
+    }
01917d
+}