From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27140 invoked by alias); 23 May 2011 04:09:28 -0000 Received: (qmail 27131 invoked by uid 22791); 23 May 2011 04:09:26 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_RMML_Stock9,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 May 2011 04:09:10 +0000 Received: (qmail 4267 invoked from network); 23 May 2011 04:09:08 -0000 Received: from unknown (HELO ?192.168.0.102?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 May 2011 04:09:08 -0000 Message-ID: <4DD9DDDA.9030602@codesourcery.com> Date: Mon, 23 May 2011 04:09:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org, "Joseph S. Myers" Subject: Re: [_Complex test 2/4] _Complex type in varargs.exp References: <4DC401D0.1050500@codesourcery.com> <4DD68727.3040502@codesourcery.com> <201105201637.19106.pedro@codesourcery.com> In-Reply-To: <201105201637.19106.pedro@codesourcery.com> Content-Type: multipart/mixed; boundary="------------050501010907050005010701" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00508.txt.bz2 This is a multi-part message in MIME format. --------------050501010907050005010701 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 2547 On 05/20/2011 11:37 PM, Pedro Alves wrote: > Did you try setup_kfail? See below. The way you have things > doesn't catch the internal error case because that is matched > within gdb_test_multiple itself. You could also check the return > of gdb_test_multiple to see if an internal match happened, but > that's more complicated than setup_kfail. > I see. It has been mentioned in the comment to proc gdb_test_multiple # Returns: # 1 if the test failed, according to a built-in failure pattern # 0 if only user-supplied patterns matched # -1 if there was an internal error. Thanks. >> > x86_64-unknown-linux-gnu: >> > KFAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, >> > fc4) (PRMS: gdb/12790) >> > KFAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, >> > dc3, dc4) (PRMS: gdb/12790) >> > FAIL: gdb.base/varargs.exp: print find_max_long_double_real(4, ldc1, >> > ldc2, ldc3, ldc4) (GDB internal error) >> > > setup_kfail gdb/12776 "i?86-*-*" > setup_kfail gdb/12790 "x86_64-*-*" > setup_kfail gdb/12791 "arm*-*-*" > set test "print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)" > gdb_test_multiple $test $test { > -re ".*= 4 \\+ 4 \\* I.*${gdb_prompt} $" { > pass $test > } > } This is exactly what I did when I was writing this patch. However, the wrong PR number is got in KFAIL result, like this, KFAIL: gdb.base/varargs.exp: print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4) (PRMS: gdb/12791) I was running test case on i686-pc-linux-gnu, but the PR number displayed was arm's PR. Source code of proc setup_kfail shows that PR number is saved in kfail_prms unconditionally. Of course, only the PR in last call of setup_kfail is saved. This is a limitation of setup_kfail, IMO. I gave up on this direction then. In order to overcome this limitation, a new proc setup_kfail_for_target is added in lib/gdb.exp, which only call setup_kfail if istarget returns true. > Maybe you can even convert the gdb_test_multiple's to gdb_test that way. > (You could also put the setup_kfails in a procedure to not need to > repeat them everywhere). Since we are using setup_kfail, we can surely convert gdb_test_multiple to gdb_test. I don't put setup_kfails in a proc, because, KFAILs on x86 are different from KFAILs on arm/x86_64. In my new patch, the internal-error on x86_64 is KFAIL'ed. KFAIL: gdb.base/varargs.exp: print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4) (GDB internal error) (PRMS: gdb/12790) -- Yao (齐尧) --------------050501010907050005010701 Content-Type: text/x-patch; name="0002-vararg-of-type-_Complex.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-vararg-of-type-_Complex.patch" Content-length: 4822 >From 9dec3cd80b6e3fa4c7544bcd1560a7abfe5a749f Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 18 May 2011 15:35:31 +0800 Subject: [PATCH 2/4] vararg of type _Complex gdb/testsuite/ Test inf-call of varargs of type _Complex. * gdb.base/varargs.c (find_max_float_real): New. (find_max_double_real, find_max_long_double_real): New. * gdb.base/varargs.exp: Call these new added functions. * lib/gdb.exp (setup_kfail_for_target): New. --- gdb/testsuite/gdb.base/varargs.c | 80 ++++++++++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/varargs.exp | 26 ++++++++++++ gdb/testsuite/lib/gdb.exp | 8 ++++ 3 files changed, 114 insertions(+), 0 deletions(-) diff --git a/gdb/testsuite/gdb.base/varargs.c b/gdb/testsuite/gdb.base/varargs.c index 1122767..1ad2ffc 100644 --- a/gdb/testsuite/gdb.base/varargs.c +++ b/gdb/testsuite/gdb.base/varargs.c @@ -23,6 +23,28 @@ float fa,fb,fc,fd; double da,db,dc,dd; double dmax_val; +#ifdef TEST_COMPLEX +extern float crealf (float _Complex); +extern double creal (double _Complex); +extern long double creall (long double _Complex); + +float _Complex fc1 = 1.0F + 1.0iF; +float _Complex fc2 = 2.0F + 2.0iF; +float _Complex fc3 = 3.0F + 3.0iF; +float _Complex fc4 = 4.0F + 4.0iF; + +double _Complex dc1 = 1.0 + 1.0i; +double _Complex dc2 = 2.0 + 2.0i; +double _Complex dc3 = 3.0 + 3.0i; +double _Complex dc4 = 4.0 + 4.0i; + +long double _Complex ldc1 = 1.0L + 1.0Li; +long double _Complex ldc2 = 2.0L + 2.0Li; +long double _Complex ldc3 = 3.0L + 3.0Li; +long double _Complex ldc4 = 4.0L + 4.0Li; + +#endif + int main() { c = -1; uc = 1; @@ -109,3 +131,61 @@ double find_max_double(int num_vals, double first_val, ...) { return max_val; } + +#ifdef TEST_COMPLEX +float _Complex +find_max_float_real (int num_vals, ...) +{ + float _Complex max = 0.0F + 0.0iF; + float _Complex x; + va_list argp; + int i; + + va_start(argp, num_vals); + for (i = 0; i < num_vals; i++) + { + x = va_arg (argp, float _Complex); + if (crealf (max) < crealf (x)) max = x; + } + + return max; +} + +double _Complex +find_max_double_real (int num_vals, ...) +{ + double _Complex max = 0.0 + 0.0i; + double _Complex x; + va_list argp; + int i; + + va_start(argp, num_vals); + for (i = 0; i < num_vals; i++) + { + x = va_arg (argp, double _Complex); + if (creal (max) < creal (x)) max = x; + } + + return max; +} + +long double _Complex +find_max_long_double_real (int num_vals, ...) +{ + long double _Complex max = 0.0L + 0.0iL; + long double _Complex x; + va_list argp; + int i; + + va_start(argp, num_vals); + for (i = 0; i < num_vals; i++) + { + x = va_arg (argp, long double _Complex); + if (creall (max) < creal (x)) max = x; + } + + return max; +} + + +#endif /* TEST_COMPLEX */ diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp index 4627862..6ecfcbf 100644 --- a/gdb/testsuite/gdb.base/varargs.exp +++ b/gdb/testsuite/gdb.base/varargs.exp @@ -44,6 +44,9 @@ if [get_compiler_info ${binfile}] { } set additional_flags {debug} +if [support_complex_tests] { + lappend additional_flags "additional_flags=-DTEST_COMPLEX" +} if {$hp_cc_compiler} { lappend additional_flags "additional_flags=-Ae" @@ -112,3 +115,26 @@ if {![target_info exists gdb,skip_float_tests]} { "print find_max_double(5,1.0,17.0,2.0,3.0,4.0)" } + +# Test _Complex type here if supported. +if [support_complex_tests] { + global gdb_prompt + + set test "print find_max_float_real(4, fc1, fc2, fc3, fc4)" + setup_kfail_for_target gdb/12790 "x86_64-*-*" + setup_kfail_for_target gdb/12791 "arm*-*-*" + gdb_test $test ".*= 4 \\+ 4 \\* I" $test + + set test "print find_max_double_real(4, dc1, dc2, dc3, dc4)" + setup_kfail_for_target gdb/12776 "i?86-*-*" + setup_kfail_for_target gdb/12790 "x86_64-*-*" + setup_kfail_for_target gdb/12791 "arm*-*-*" + gdb_test $test ".*= 4 \\+ 4 \\* I" $test + + set test "print find_max_long_double_real(4, ldc1, ldc2, ldc3, ldc4)" + setup_kfail_for_target gdb/12776 "i?86-*-*" + setup_kfail_for_target gdb/12790 "x86_64-*-*" + setup_kfail_for_target gdb/12791 "arm*-*-*" + gdb_test $test ".*= 4 \\+ 4 \\* I" $test + +} diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b9d5752..a63dd61 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2996,6 +2996,14 @@ proc setup_xfail_format { format } { return $ret; } +# Like setup_kfail, but only call setup_kfail conditionally if +# istarget[TARGET] returns true. +proc setup_kfail_for_target { PR target } { + if { [istarget $target] } { + setup_kfail $PR $target + } +} + proc gdb_step_for_stub { } { global gdb_prompt; -- 1.7.0.4 --------------050501010907050005010701--