From patchwork Fri Nov 7 23:09:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 408319 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 1C800140082 for ; Sat, 8 Nov 2014 10:09:48 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=hlhAbJJiq9EvwTCNLpOwFRF1LEkqjP2D/b7la2WmRVoSy7 GI4LsEKt7+HxPg7Ifpr4uKesqrtdfhh3X4NtakzJNJaT24Mi1DJpFeLWsMnfxGrj iCmopLca2DedH/Yl/rdMS5ov02Hep/RSwNUY6Rag9OdfyZaWzvgX7fKDAGH2A= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=nzpF89G9x3iJGsJ2HrW/YuWbOKQ=; b=i/Ps63jE9bADKXQHrX9g r73d0zp4kdiaD4OBrQ37crVwYSsPG4CjnP3lFgou/AORZiht9B+LUsV6WGB3Qx0D 2WhRZnhiUF1HIQd3TMRQ33BLP4qJE1dsjOqMMObcljQGo7sjrImKl81tWKwHNBki MIbJFXUl5xD7HcW8U32nP+M= Received: (qmail 8442 invoked by alias); 7 Nov 2014 23:09:40 -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 8428 invoked by uid 89); 7 Nov 2014 23:09:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f52.google.com Received: from mail-la0-f52.google.com (HELO mail-la0-f52.google.com) (209.85.215.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 07 Nov 2014 23:09:29 +0000 Received: by mail-la0-f52.google.com with SMTP id pv20so5121099lab.25 for ; Fri, 07 Nov 2014 15:09:25 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.153.11.133 with SMTP id ei5mr13893762lad.75.1415401765280; Fri, 07 Nov 2014 15:09:25 -0800 (PST) Received: by 10.25.30.7 with HTTP; Fri, 7 Nov 2014 15:09:25 -0800 (PST) Date: Fri, 7 Nov 2014 15:09:25 -0800 Message-ID: Subject: [Committed] Add a testcase for miscompile From: Andrew Pinski To: GCC Patches X-IsSubscribed: yes Hi, When I was developing a patch 2 years ago, I ran across us mis-compiling libcpp/expr.c's num_equality_op. I noticed today I never added the testcase upstream for this mis-compiling. I noticed because I was porting the patch I had developed to the trunk and I had missed the fix and I was getting a bootstrap failure but there was no testsuite failures that was testing the problem. Committed after a quick test to make sure the testcase is still a valid executable testcase now. Thanks, Andrew Pinski * gcc.c-torture/execute/20141107-1.c: New testcase. Index: gcc.c-torture/execute/20141107-1.c =================================================================== --- gcc.c-torture/execute/20141107-1.c (revision 0) +++ gcc.c-torture/execute/20141107-1.c (revision 217242) @@ -0,0 +1,27 @@ +#define bool _Bool + +bool f(int a, bool c) __attribute__((noinline)); +bool f(int a, bool c) +{ + if (!a) + c = !c; + return c; +} + +void checkf(int a, bool b) +{ + bool c = f(a, b); + char d; + __builtin_memcpy (&d, &c, 1); + if ( d != (a==0)^b) + __builtin_abort(); +} + +int main(void) +{ + checkf(0, 0); + checkf(0, 1); + checkf(1, 1); + checkf(1, 0); + return 0; +} Index: ChangeLog =================================================================== --- ChangeLog (revision 217241) +++ ChangeLog (revision 217242) @@ -1,3 +1,7 @@ +2014-11-07 Andrew Pinski + + * gcc.c-torture/execute/20141107-1.c: New testcase. + 2014-11-07 Richard Biener PR tree-optimization/63605