From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4354 invoked by alias); 5 Dec 2017 13:36:32 -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 4343 invoked by uid 89); 5 Dec 2017 13:36:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Dec 2017 13:36:27 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3772A806A4 for ; Tue, 5 Dec 2017 13:36:26 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D27C660605 for ; Tue, 5 Dec 2017 13:36:25 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vB5DaNpj022124 for ; Tue, 5 Dec 2017 14:36:23 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vB5DaMmE022123 for gcc-patches@gcc.gnu.org; Tue, 5 Dec 2017 14:36:22 +0100 Date: Tue, 05 Dec 2017 13:36:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Add testcase for already fixed PR (PR tree-optimization/83283) Message-ID: <20171205133622.GV2353@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00221.txt.bz2 Hi! This testcase has been fixed by r253146 but that testcase is quite different from this one, so I've committed this to trunk as obvious. 2017-12-05 Jakub Jelinek PR tree-optimization/83283 * g++.dg/torture/pr83283.C: New test. --- gcc/testsuite/g++.dg/torture/pr83283.C.jj 2017-12-05 13:01:03.432144366 +0100 +++ gcc/testsuite/g++.dg/torture/pr83283.C 2017-12-05 13:00:55.926238921 +0100 @@ -0,0 +1,26 @@ +// PR tree-optimization/83283 +// { dg-do run } +// { dg-additional-options "-std=c++11" } + +enum E : unsigned char { X = 0, Y = 1 }; + +void __attribute__((noinline)) +foo (E *v, int size) +{ + for (int i = 0; i < size; ++i) + { + const bool b = (v[i] == E::Y); + v[i] = static_cast(static_cast(b)); + } +} + +int +main () +{ + constexpr int items = 32; + E vals[items] = {X}; + vals[3] = Y; + foo (vals, items); + if (vals[3] != 1) + __builtin_abort (); +} Jakub