From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6698 invoked by alias); 11 Jun 2013 23:00:56 -0000 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 Received: (qmail 6682 invoked by uid 89); 11 Jun 2013 23:00:55 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-vb0-f43.google.com (HELO mail-vb0-f43.google.com) (209.85.212.43) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 11 Jun 2013 23:00:55 +0000 Received: by mail-vb0-f43.google.com with SMTP id e12so3210368vbg.30 for ; Tue, 11 Jun 2013 16:00:53 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.164.19 with SMTP id ym19mr7560651vdb.38.1370991653436; Tue, 11 Jun 2013 16:00:53 -0700 (PDT) Received: by 10.58.219.6 with HTTP; Tue, 11 Jun 2013 16:00:53 -0700 (PDT) In-Reply-To: <51B22951.1000601@linaro.org> References: <51B22951.1000601@linaro.org> Date: Tue, 11 Jun 2013 23:02:00 -0000 Message-ID: Subject: Re: [PATCH] testsuite/gdb.base: Make skip test not rely on undefined behaviour. From: Andrew Pinski To: Will Newton Cc: "gdb-patches@sourceware.org" , Patch Tracking Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2013-06/txt/msg00265.txt.bz2 On Fri, Jun 7, 2013 at 11:41 AM, Will Newton wrote: > > The skip test currently relies on the order of evaluation of > arguments which is not defined. Use an arithmetic expression > where order is defined instead. No the order is not defined there either. The left side or the right side of the addition can be evaluated first as there is no sequence point. Maybe it is better to do: baz((foo(), bar())); The order with that is defined as the comma operator is a sequence point. Thanks, Andrew Pinski > > gdb/testsuite/ChangeLog: > > 2013-06-07 Will Newton > > * gdb.base/skip.c: Add results of foo() and bar() before > passing to baz(). > * gdb.base/skip.c: baz() now takes one argument instead of > two. > --- > gdb/testsuite/gdb.base/skip.c | 4 ++-- > gdb/testsuite/gdb.base/skip1.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/skip.c b/gdb/testsuite/gdb.base/skip.c > index 565ba93..1281d17 100644 > --- a/gdb/testsuite/gdb.base/skip.c > +++ b/gdb/testsuite/gdb.base/skip.c > @@ -1,10 +1,10 @@ > int foo(); > int bar(); > -int baz(int, int); > +int baz(int); > > int main() > { > - return baz(foo(), bar()); > + return baz(bar() + foo()); > } > > int foo() > diff --git a/gdb/testsuite/gdb.base/skip1.c b/gdb/testsuite/gdb.base/skip1.c > index 2dab5c3..fe63cd6 100644 > --- a/gdb/testsuite/gdb.base/skip1.c > +++ b/gdb/testsuite/gdb.base/skip1.c > @@ -3,7 +3,7 @@ int bar() > return 1; > } > > -int baz(int a, int b) > +int baz(int a) > { > - return a + b; > + return a + 1; > } > -- > 1.8.1.4 >