From patchwork Mon Dec 15 07:26:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Huber X-Patchwork-Id: 420987 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 7B4841400B7 for ; Mon, 15 Dec 2014 18:27:02 +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:from :to:cc:subject:date:message-id; q=dns; s=default; b=nNdJyQmU2NnE WjUc3lPKh/QG/y5Rn+37eZDUkXb7uTrnuTl2ZRPPhYJ5vDER2iCwT0qNCtJApSnc evLDg51KGH6haYnqYxdQcjhzaqNdK7rZGDcjyk+xRxhi95Qz2iG5qhDNb1rb9rQ5 YtWDIa0PVNghles7JBhNFyixycByV9w= 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:cc:subject:date:message-id; s=default; bh=KuYodnlkZ6nSTtZrwR Fs/sxnUF4=; b=NYZrqypk8ztrbWO8QZaXeg+Bz+5FsYWnPAFJ3WfIdQ68CBMdVA 1Foj0OfIJf5L2XmxLfYvCUZYi/JwJphJX6Fnl5hgmaFL8I0cKn6rbFJTTV2d6iyj 2hZS4JNQCJzeG7HDcSLd9ZERvEtx3GEu0PDUjU+kE4r4LD8LrcPBUdFyE= Received: (qmail 531 invoked by alias); 15 Dec 2014 07:26:54 -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 522 invoked by uid 89); 15 Dec 2014 07:26:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-out.m-online.net Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Mon, 15 Dec 2014 07:26:51 +0000 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3k1DgX31yvz3hjWQ for ; Mon, 15 Dec 2014 08:26:48 +0100 (CET) Received: from mail.embedded-brains.de (host-82-135-62-35.customer.m-online.net [82.135.62.35]) by mail.mnet-online.de (Postfix) with ESMTP id 3k1DgX0zBMzvh4C for ; Mon, 15 Dec 2014 08:26:48 +0100 (CET) Received: by mail.embedded-brains.de (Postfix, from userid 65534) id B15FD652CFD; Mon, 15 Dec 2014 08:26:47 +0100 (CET) Received: from self.eb.z (unknown [192.168.100.11]) by mail.embedded-brains.de (Postfix) with ESMTP id 3370065253A; Mon, 15 Dec 2014 08:26:47 +0100 (CET) From: Sebastian Huber To: gcc-patches@gcc.gnu.org Cc: Sebastian Huber Subject: [PATCH] gcc/testsuite/gcc.dg/typeof-2.c Date: Mon, 15 Dec 2014 08:26:45 +0100 Message-Id: <1418628405-5222-1-git-send-email-sebastian.huber@embedded-brains.de> X-IsSubscribed: yes gcc/testsuite/ChangeLog 2014-12-15 Sebastian Huber * gcc.dg/typeof-2.c: Add checks for non-atomic types. --- gcc/testsuite/gcc.dg/typeof-2.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gcc/testsuite/gcc.dg/typeof-2.c b/gcc/testsuite/gcc.dg/typeof-2.c index e916900..21ef5b0 100644 --- a/gcc/testsuite/gcc.dg/typeof-2.c +++ b/gcc/testsuite/gcc.dg/typeof-2.c @@ -2,6 +2,8 @@ /* { dg-do compile } */ /* { dg-options "-std=c11" } */ +/* Check that the qualifiers are discarded for atomic types. */ + extern int i; extern int * p; @@ -26,3 +28,32 @@ void f(void) __auto_type ari = ri; int **pari = &ari; } + +/* Check that the qualifiers are preserved for non-atomic types. */ + +extern int const j; + +extern int volatile k; + +extern int * restrict q; + +extern int const nci; +extern __typeof (nci) j; + +extern int volatile nvi; +extern __typeof (nvi) k; + +extern int * restrict nri; +extern __typeof (nri) q; + +void g(void) +{ + __auto_type aci = nci; + int const *paci = &aci; + + __auto_type avi = nvi; + int volatile *pavi = &avi; + + __auto_type ari = nri; + int * restrict *pari = &ari; +}