From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3882 invoked by alias); 11 Apr 2013 12:42:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3871 invoked by uid 89); 11 Apr 2013 12:42:32 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_AV,TW_VP autolearn=ham version=3.3.1 Received: from mail-we0-f178.google.com (HELO mail-we0-f178.google.com) (74.125.82.178) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 12:42:31 +0000 Received: by mail-we0-f178.google.com with SMTP id z53so1248843wey.9 for ; Thu, 11 Apr 2013 05:42:29 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.11.238 with SMTP id t14mr33728128wib.3.1365684149685; Thu, 11 Apr 2013 05:42:29 -0700 (PDT) Received: by 10.194.56.100 with HTTP; Thu, 11 Apr 2013 05:42:29 -0700 (PDT) In-Reply-To: References: Date: Thu, 11 Apr 2013 13:10:00 -0000 Message-ID: Subject: Re: [testsuite, i386] Reimplementing array comparison in avx2-vpop-check.h From: Richard Biener To: Alexander Ivchenko Cc: GCC Patches , Uros Bizjak Content-Type: text/plain; charset=ISO-8859-1 X-SW-Source: 2013-04/txt/msg00705.txt.bz2 On Thu, Apr 11, 2013 at 1:58 PM, Alexander Ivchenko wrote: > Hi, > > Usually does not include but on bionic it is > historically included. memcmp() reacts on a volatile argument > differently, depending on whether is included or not. If it > is included, then the compiler will generate a warning: > warning: passing argument 2 of 'memcmp' discards 'volatile' qualifier > from pointer target type [enabled by default] > > In avx2-vpop-check.h we compare two arrays using memcmp(), and since > one of them is declared as volatile we have test-fails because of that > warning. The following patch reimplements the comparison using just > for-loop: > > diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog > index 943be90..9b08eb0 100644 > --- a/gcc/testsuite/ChangeLog > +++ b/gcc/testsuite/ChangeLog > @@ -1,3 +1,7 @@ > +2013-04-11 Grigoriy Kraynov > + > + * gcc.target/i386/avx2-vpop-check.h: memcmp() replaced by for loop. > + > 2013-04-11 Paolo Carlini > > PR c++/54216 > diff --git a/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h > b/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h > index 143b54da..921ed0b 100644 > --- a/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h > +++ b/gcc/testsuite/gcc.target/i386/avx2-vpop-check.h > @@ -47,7 +47,8 @@ avx2_test (void) > gen_pop (); > check_pop (); > > - if (memcmp (c, c_ref, SIZE * sizeof (TYPE))) > - abort(); > + for (i = 0; i < SIZE; ++i) > + if (c[i] != c_ref[i]) > + abort(); > } > } > > > is it OK? Just cast away the volatileness? memcmp (c, (void *)c_ref, ...)? Richard. > thanks, > Alexander