From patchwork Thu Oct 24 16:45:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Clifton X-Patchwork-Id: 285980 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B1A02C0095 for ; Fri, 25 Oct 2013 03:47:18 +1100 (EST) 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=nmCydZS6kr30fsGwsQziI13ycAtuhLi7Nk/YdkFykqmRRA4KPOk91 Su8gNn3lYF/5yUAejtlt1WqM2JGN92ViWrw76rvpVgjdMzqQNIjUZC2csAuw3MmW fX2cjHDzccGqE4EN9RZfAnIqZBoUMZLL+161BMMr/mH/fCRSfEP0SM= 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=xoz1g6cf2vCNOm3pDJm08KNTOm0=; b=KSeqLg66gsvju5h3AfBZ KVhuZb96GYfP5xiaHJQhQHhwA0Mz8RUhqepfWd4wWSm5W+EbZnMyUcs4HZhaM1hZ y/T3ZtwHA1Br0eHHPQng+Trs6US53YgD9iolGDr3z9JUZwDiIK7RkCbkYPdqfJDd bcVkBYvixqh6JTx9QVBQqic= Received: (qmail 21114 invoked by alias); 24 Oct 2013 16:47:12 -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 21101 invoked by uid 89); 24 Oct 2013 16:47:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 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; Thu, 24 Oct 2013 16:47:11 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9OGl924014218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 24 Oct 2013 12:47:09 -0400 Received: from Cadeux.redhat.com (vpn1-6-252.ams2.redhat.com [10.36.6.252]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9OGl4mG030243 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 24 Oct 2013 12:47:08 -0400 From: Nick Clifton To: gcc-patches@gcc.gnu.org Subject: RFA: Remove some assumptions from gcc.dg tests Date: Thu, 24 Oct 2013 17:45:21 +0100 Message-ID: <874n86hb32.fsf@redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi Guys, The patch below includes a selection of improvements for the tests in the gcc.dg part of the gcc testsuite. It basically annotates tests that have some implicit assumptions about the target that is being tested (word size, supported features, etc). I started making this patch originally just for the MSP430, and so I was adding target specific exceptions. Then I realised that the exceptions would apply to other targets too and that it was better to add dg-require-effective-target-foo statements instead. Tested with an msp430-elf toolchain and an i686-pc-linux-gnu toolchain with no regressions and several improvements. OK to apply ? Cheers Nick gcc/testsuite/ChangeLog 2013-10-24 Nick Clifton * c-c++-common/pr57793.c: Add expected error messages for targets with small integers. * gcc.dg/c99-stdint-1.c: Only run on 32-bit plus targets. * gcc.dg/c99-stdint-2.c: Likewise. * gcc.dg/cdce1.c: Likewise. * gcc.dg/fold-overflow-1.c: Likewise. * gcc.dg/utf-cvt.c: Likewise. * gcc.dg/ftrapv-1.c: Only run on targets that support trapping arithmetic. * gcc.dg/ftrapv-2.c: Likewise. * gcc.dg/pr30286.c: Likewise. * gcc.dg/pr19340.c: Only run on targets that support scheduling. * lib/target-supports.exp (check_effective_target_trapping): New proc. Returns true if the target supports trapping arithmetic. Index: gcc/testsuite/c-c++-common/pr57793.c =================================================================== --- gcc/testsuite/c-c++-common/pr57793.c (revision 204016) +++ gcc/testsuite/c-c++-common/pr57793.c (working copy) @@ -3,8 +3,8 @@ struct A { unsigned a : 1; unsigned b : 1; }; struct B /* { dg-error "type .B. is too large" "" { target { c++ && ilp32 } } } */ { - unsigned char c[0x40000000]; - unsigned char d[0x40000ff0]; + unsigned char c[0x40000000]; /* { dg-error "size of array .c. is too large" "" { target { ! int32plus } } } */ + unsigned char d[0x40000ff0];/* { dg-error "size of array .d. is too large" "" { target { ! int32plus } } } */ struct A e; }; /* { dg-error "type .struct B. is too large" "" { target { c && ilp32 } } } */ Index: gcc/testsuite/gcc.dg/c99-stdint-1.c =================================================================== --- gcc/testsuite/gcc.dg/c99-stdint-1.c (revision 204016) +++ gcc/testsuite/gcc.dg/c99-stdint-1.c (working copy) @@ -9,6 +9,7 @@ version). */ /* { dg-do compile } */ /* { dg-options "-std=iso9899:1999 -pedantic-errors -fhosted" } */ +/* { dg-require-effective-target ptr32plus } */ #include #include @@ -214,7 +215,6 @@ void test_misc_limits (void) { -/* { dg-bogus "size" "ptrdiff is 16bits" { xfail avr-*-* } 56 } */ CHECK_SIGNED_LIMITS_2(__PTRDIFF_TYPE__, PTRDIFF_MIN, PTRDIFF_MAX, -65535L, 65535L); #ifndef SIGNAL_SUPPRESS CHECK_LIMITS_2(sig_atomic_t, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX, -127, 127, 255); Index: gcc/testsuite/gcc.dg/c99-stdint-2.c =================================================================== --- gcc/testsuite/gcc.dg/c99-stdint-2.c (revision 204016) +++ gcc/testsuite/gcc.dg/c99-stdint-2.c (working copy) @@ -2,7 +2,7 @@ Freestanding version. */ /* { dg-do compile } */ /* { dg-options "-std=iso9899:1999 -pedantic-errors -ffreestanding" } */ -/* { dg-xfail-if "ptrdiff size is 16bits" { avr-*-* } } */ +/* { dg-require-effective-target ptr32plus } */ /* The test is that there are no diagnostics, so just include the hosted version. */ #include "c99-stdint-1.c" Index: gcc/testsuite/gcc.dg/cdce1.c =================================================================== --- gcc/testsuite/gcc.dg/cdce1.c (revision 204016) +++ gcc/testsuite/gcc.dg/cdce1.c (working copy) @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */ -/* { dg-final { scan-tree-dump "cdce1.c:16: note: function call is shrink-wrapped into error conditions\." "cdce" } } */ +/* { dg-require-effective-target int32plus } */ +/* { dg-final { scan-tree-dump "cdce1.c:17: note: function call is shrink-wrapped into error conditions\." "cdce" } } */ /* { dg-final { cleanup-tree-dump "cdce" } } */ /* { dg-require-effective-target large_double } */ Index: gcc/testsuite/gcc.dg/fold-overflow-1.c =================================================================== --- gcc/testsuite/gcc.dg/fold-overflow-1.c (revision 204016) +++ gcc/testsuite/gcc.dg/fold-overflow-1.c (working copy) @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-skip-if "consts are shorts, not longs" { "m32c-*-*" "avr-*-*" } { "*" } { "" } } */ +/* { dg-require-effective-target int32plus } */ /* { dg-skip-if "No Inf support" { spu-*-* } } */ /* { dg-options "-O -ftrapping-math" } */ Index: gcc/testsuite/gcc.dg/ftrapv-1.c =================================================================== --- gcc/testsuite/gcc.dg/ftrapv-1.c (revision 204016) +++ gcc/testsuite/gcc.dg/ftrapv-1.c (working copy) @@ -7,6 +7,7 @@ /* { dg-do run } */ /* { dg-options "-ftrapv" } */ +/* { dg-require-effective-target trapping } */ __attribute__((noinline)) int mulv(int a, int b) Index: gcc/testsuite/gcc.dg/ftrapv-2.c =================================================================== --- gcc/testsuite/gcc.dg/ftrapv-2.c (revision 204016) +++ gcc/testsuite/gcc.dg/ftrapv-2.c (working copy) @@ -8,6 +8,7 @@ /* { dg-do run } */ /* { dg-options "-ftrapv" } */ +/* { dg-require-effective-target trapping } */ extern void abort(void); extern long labs(long); Index: gcc/testsuite/gcc.dg/pr19340.c =================================================================== --- gcc/testsuite/gcc.dg/pr19340.c (revision 204016) +++ gcc/testsuite/gcc.dg/pr19340.c (working copy) @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fschedule-insns2 -fsched2-use-superblocks" } */ -/* { dg-skip-if "No scheduling" { mmix-*-* cris-*-* crisv32-*-* fido-*-* m68k-*-* m32c-*-* avr-*-* moxie-*-* } { "*" } { "" } } */ +/* { dg-require-effective-target scheduling } */ extern double f (double x); Index: gcc/testsuite/gcc.dg/pr30286.c =================================================================== --- gcc/testsuite/gcc.dg/pr30286.c (revision 204016) +++ gcc/testsuite/gcc.dg/pr30286.c (working copy) @@ -1,6 +1,7 @@ /* PR middle-end/30286 */ /* { dg-do run } */ /* { dg-options "-O2 -ftrapv" } */ +/* { dg-require-effective-target trapping } */ extern void abort (void); struct S { struct S *s; }; Index: gcc/testsuite/gcc.dg/pr38364.c =================================================================== --- gcc/testsuite/gcc.dg/pr38364.c (revision 204016) +++ gcc/testsuite/gcc.dg/pr38364.c (working copy) @@ -1,6 +1,7 @@ /* PR middle-end/38364 */ /* { dg-do run } */ /* { dg-options "-O2 -ftrapv" } */ +/* { dg-require-effective-target trapping } */ extern void abort (void); Index: gcc/testsuite/gcc.dg/utf-cvt.c =================================================================== --- gcc/testsuite/gcc.dg/utf-cvt.c (revision 204016) +++ gcc/testsuite/gcc.dg/utf-cvt.c (working copy) @@ -1,7 +1,7 @@ /* Contributed by Kris Van Hees */ /* Test the char16_t and char32_t promotion rules. */ /* { dg-do compile } */ -/* { dg-excess-errors "short and int are 16bit" { target { "avr-*-*" } } } */ +/* { dg-require-effective-target int32plus } */ /* { dg-options "-std=gnu99 -Wall -Wconversion -Wsign-conversion" } */ typedef __CHAR16_TYPE__ char16_t; Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp (revision 204016) +++ gcc/testsuite/lib/target-supports.exp (working copy) @@ -701,6 +701,14 @@ } "-fschedule-insns"] } +# Return 1 if trapping arithmetic is available, 0 otherwise. + +proc check_effective_target_trapping {} { + return [check_no_compiler_messages scheduling object { + add (int a, int b) { return a + b; } + } "-ftrapv"] +} + # Return 1 if compilation with -fgraphite is error-free for trivial # code, 0 otherwise.