From patchwork Wed Oct 5 17:16:36 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: 678551 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 3sq2YH2Gjpz9sD5 for ; Thu, 6 Oct 2016 04:18:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=gMzlNA+n; 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:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=LAKwQ5uHfLUAa+d/59K9DBYzBHwX688XvRNmEJJA5AzloKwJepsOW wkAJ0FrTMpVgoe6bKVTiUJZ88F/JdmCjDdxuySqowMCvAhyqWrPkqGbCS0nvm0ey WCQE/DvlO0aa8VCSla7DQkGsJAQ3kE16ZAfU5sWH7ogdb3kDtixyTY= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=UdHwT3NkbwH9gW6JbebE5LxfRT8=; b=gMzlNA+njIZtoPFfU3er dli/B+zxszFy8m3wbWZC6m2a+6jPSVs4MFpopPDdTyg8+2C87u5DbRbKZWslHBER hawiGeHUSZJxV+pdNwakqZQXOzQYQ9M/hIoqO+b9EQo88oeJR88P8VGGvqej1WXZ +rYDnJIIkvuCSvWSnU1JzD4= Received: (qmail 114386 invoked by alias); 5 Oct 2016 17:18:00 -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 114361 invoked by uid 89); 5 Oct 2016 17:17:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=H*RU:14.3.235.1, H*F:D*atmel.com, H*r:14.3.235, H*M:atmel 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 ESMTP; Wed, 05 Oct 2016 17:17:49 +0000 Received: from HNOCHT02.corp.atmel.com (10.145.133.41) by eusmtp01.atmel.com (10.145.145.31) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 5 Oct 2016 19:17:42 +0200 Received: from jaguar.atmel.com (10.145.133.18) by HNOCHT02.corp.atmel.com (10.145.133.41) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 5 Oct 2016 19:17:45 +0200 User-agent: mu4e 0.9.17; emacs 24.5.1 From: Senthil Kumar Selvaraj To: gcc-patches List Subject: [Patch, testsuite] Fix pr69941.c test failure for avr Date: Wed, 5 Oct 2016 22:46:36 +0530 Message-ID: <87y4224sy3.fsf@atmel.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi, The below patch fixes gcc.dg/torture/pr69941.c to pass for int size != 32 targets like avr. For the avr target, ints are 16 bits wide. VRP concludes that a right shift by 9 followed by an equality comparison to 0x74 can never be true, and ends up eliminating the conditional. The code ends up unconditionally calling __builtin_abort and obviously fails when run. The patch fixes the testcase to use __INT32_TYPE__ (via a typedef) if __SIZEOF_INT__ is less than 4. Regtested with both avr and x86_64, the test passes with both targets. Regards Senthil gcc/testsuite/ChangeLog 2016-10-05 Senthil Kumar Selvaraj * gcc.dg/torture/pr69941.c: Use __INT32_TYPE__ instead of int if __SIZEOF_INT__ is less than 4 bytes. Index: gcc/testsuite/gcc.dg/torture/pr69941.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr69941.c (revision 240781) +++ gcc/testsuite/gcc.dg/torture/pr69941.c (working copy) @@ -1,11 +1,17 @@ /* { dg-do run } */ + +#if __SIZEOF_INT__ < 4 +__extension__ typedef __INT32_TYPE__ int32_t; +#else +typedef int int32_t; +#endif int a = 0; int b = 0; int c = 0; -int e = 0; +int32_t e = 0; int f = 0; -int *g = &e; +int32_t *g = &e; int fn1() { return b ? a : b; }