From patchwork Tue Jul 26 08:08:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Senthil Kumar Selvaraj X-Patchwork-Id: 652629 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rz9kS6YsTz9t1D for ; Tue, 26 Jul 2016 18:09:04 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=VuE0WHrH; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; q=dns; s=default; b=DedcALUEV8PAAUYS YKlf8TIgzu3FGKXHSS/TFUZyr3AUub/oYnOY8LgbWaJ3O7fFm3IGq7IlFED95X8v wNqbkaVPqFWhmyJbbCAFp+W+fnvYDtDZWNEgidoIQHE8VWJDzH2OcGQtkbX9aX8R yqWel6jQBrUR4DKlIOS6mDh1zX0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; s=default; bh=72M1dOOWTBshitBdWEtrEh yV6Nw=; b=VuE0WHrH7/9PYpzKI7an/6aijM9/TN22WpfqvDC9FiiRKwkoGHwi5N X5f0zR4PnvfyUoY6B6s0C7NXw1gVjIvBzwxiYB7YvskG6MchT+oshCHMSvCs2xz1 KTeEyvDrs7elFBLmSX33Iey8FhqQEAjc0MvPdmFooRVpQbJgWGclU= Received: (qmail 68960 invoked by alias); 26 Jul 2016 08:08:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 68936 invoked by uid 89); 26 Jul 2016 08:08:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Stump, stump, HTo:D*comcast.net, inb X-HELO: eusmtp01.atmel.com Received: from eusmtp01.atmel.com (HELO eusmtp01.atmel.com) (212.144.249.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 26 Jul 2016 08:08:44 +0000 Received: from HNOCHT02.corp.atmel.com (10.161.30.162) by eusmtp01.atmel.com (10.161.101.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 26 Jul 2016 10:08:38 +0200 Received: from jaguar.atmel.com (10.161.30.18) by HNOCHT02.corp.atmel.com (10.161.30.162) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 26 Jul 2016 10:08:38 +0200 References: <87zip6udul.fsf@atmel.com> <4610F808-B354-4F66-B8B0-2EA1297460DE@comcast.net> User-agent: mu4e 0.9.17; emacs 24.5.1 From: Senthil Kumar Selvaraj To: Mike Stump CC: GCC Patches Subject: Re: [Patch, testuite, committed] Fix some more tests that fail for non 32-bit int targets In-Reply-To: <4610F808-B354-4F66-B8B0-2EA1297460DE@comcast.net> Date: Tue, 26 Jul 2016 13:38:04 +0530 Message-ID: <87y44ovn2z.fsf@atmel.com> MIME-Version: 1.0 X-IsSubscribed: yes Mike Stump writes: > On Jul 25, 2016, at 5:00 AM, Senthil Kumar Selvaraj wrote: >> >> The below patch fixes tests that fail for the avr target, because they >> assume ints are atleast 32 bits wide and pointers and longs have the >> same size. >> >> I've required int32plus support for one test, and for the other two, >> I've introduced a cast to intptr_t to avoid the pointer <-> int size >> difference warning. >> >> Reg tested on avr and x86_64 with no regressions. Committed as >> obvious. > > Can you use __INTPTR_TYPE__ instead? This way, you don't need to add any include, and the test case will work in cross environments without any libc, which is at times handy. Thanks. > > See grep INTPTR gcc/gcc/testsuite/gcc.dg/*.c for how people use it, and for the unsigned version. > >> 2016-07-25 Senthil Kumar Selvaraj >> >> * gcc.dg/torture/pr69352.c (foo): Cast to intptr_t instead of long. >> * gcc.dg/torture/pr69771.c: Require int32plus. >> * gcc.dg/torture/pr71866.c (inb): Add cast to intptr_t. I'll keep that in mind, thanks. Is the below patch ok? I used uintptr_t in the second test as the source type is unsigned long. Regards Senthil Index: pr69352.c =================================================================== --- pr69352.c (revision 238743) +++ pr69352.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ -#include +__extension__ typedef __INTPTR_TYPE__ intptr_t; int a[10][14], b, c, d, e, f, g, h, i; void bar (void); Index: pr71866.c =================================================================== --- pr71866.c (revision 238743) +++ pr71866.c (working copy) @@ -1,7 +1,8 @@ /* { dg-do compile } */ /* { dg-additional-options "-ftree-pre -fcode-hoisting" } */ -#include +__extension__ typedef __UINTPTR_TYPE__ uintptr_t; + typedef unsigned char u8; extern unsigned long pci_io_base; u8 in_8 (const volatile void *); @@ -26,7 +27,7 @@ static inline u8 inb (unsigned long port) { - return readb((volatile void *)(intptr_t)pci_io_base + port); + return readb((volatile void *)(uintptr_t)pci_io_base + port); } static inline void outb (u8 val, unsigned long port)