From patchwork Mon Dec 31 14:39:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jozef Lawrynowicz X-Patchwork-Id: 1019586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-493221-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mittosystems.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="wnNbDjFk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mittosystems.com header.i=@mittosystems.com header.b="k/Qd9/OK"; dkim-atps=neutral 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 43T0Mh1njHz9s7h for ; Tue, 1 Jan 2019 01:39:57 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=JjQ2+ecnQ4pX14zG9AegzGIyWi3GCvloIcSMotGBXUp35Js8izmiV BpKlnotCVnJOoCSap22AwZMHZbV2mIykBvOesL7+VxNBfcUpFaeBQpNN8SSIeBPB B7gjAgw9CZ3q/voqkLsAPW9bSwqVJAWcBI6TJ4uOEM4WpKCA57JBF8= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=pPb9pOuUi1n/76wFYzofAKd7sPE=; b=wnNbDjFkON69oW1wRFc2 +PTddJfXuSev8SVTFJMoNMGPvaLQ+vy+YQZYGN/Sn628K5wdf2C6Xo9ek03dAekk ndUbPioeDGtSus/tYWDOZ1DGG6bsocS7K16Y9XwxpiCO5Z7lAWRG7dJKwjSFonSt JsHewBC1oAOJOq72Inzrsu0= Received: (qmail 32075 invoked by alias); 31 Dec 2018 14:39:50 -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 32063 invoked by uid 89); 31 Dec 2018 14:39:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Exercise, abi, ZERO, ABI X-HELO: mail-wm1-f42.google.com Received: from mail-wm1-f42.google.com (HELO mail-wm1-f42.google.com) (209.85.128.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Dec 2018 14:39:43 +0000 Received: by mail-wm1-f42.google.com with SMTP id y139so23467191wmc.5 for ; Mon, 31 Dec 2018 06:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mittosystems.com; s=google; h=date:from:to:subject:message-id:mime-version; bh=G3VebxIMwRDR+NJP2HuGRixhE8jJJF6w80Vby5IM7Qg=; b=k/Qd9/OKzIWybZlRk6ZSevtoI2BtC4qYOFR7Lmc5rr9nD0HzUMKdd6acO0TuVcek5r KgOpthfvxnZDRgNS/cu6PmMI0nrRiTTFAKBQT0lq4Y6icPA+4lkqco3Ie0J9hbbgLs3V pNEdq8iCxr8gokDYn0gc9I3oye8aUCyyAsNF5NwhDnfWCDlT+suoPFuQaLTRrJUSPJH9 bV8Qh8apTqBDitfBPNLY1xf/SF2vGJkSi9RWOLIIp7xYFPte4+1hwRjsdE1PFMffsK3d BHGui6has3I7cGzeDwyExleB4RKQNfbeEgEQlPluGuQHqmiFBWczsIaekCEN6H987B6J Eshw== Received: from jozef-Aspire-VN7-793G ([2a01:4b00:87fd:900:45c9:6838:324d:b158]) by smtp.gmail.com with ESMTPSA id g67sm39369107wmd.38.2018.12.31.06.39.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Dec 2018 06:39:40 -0800 (PST) Date: Mon, 31 Dec 2018 14:39:38 +0000 From: Jozef Lawrynowicz To: Subject: [ping][PATCH][MSP430][TESTSUITE] Fix tests for msp430-elf large memory model Message-ID: <20181231143938.33fc09ee@jozef-Aspire-VN7-793G> MIME-Version: 1.0 X-IsSubscribed: yes Previous submission: https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01885.html The attached patch fixes various tests for msp430-elf with -mlarge. Succesfully regtested x86_64-pc-linux-gnu and msp430-elf/-mlarge. Ok for trunk? From 4cfb2ecd0e0580f69790fadd68b77e8a82992ef4 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Sat, 10 Nov 2018 16:08:44 +0000 Subject: [PATCH] [TESTSUITE] Fix tests for msp430-elf large memory model 2018-11-21 Jozef Lawrynowicz gcc/ChangeLog: * doc/sourcebuild.texi: Document check_effective_target_msp430_large_mem. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/991014-1.c: Fix bufsize definition for msp430 large memory model. * gcc.dg/Walloca-1.c: Don't expect warning for msp430 large memory model. * gcc.dg/Walloca-2.c: Likewise. * gcc.dg/c99-const-expr-2.c: Define ZERO macro for msp430 large memory model. * gcc.dg/format/format.h: Prefix typedefs using __SIZE_TYPE__ and __PTRDIFF_TYPE__ with __extension__. * gcc.dg/lto/20081210-1_0.c: Always typedef uintptr_t as __UINTPTR_TYPE__. * gcc.dg/pr36227.c: Likewise. * gcc.dg/pr42611.c: Use __INTPTR_MAX__ as the maximum object size if size_t and ptr_t are the same size. * gcc.dg/pr78973.c: dg-warning XFAIL for int16 but not msp430 large memory model. * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Update dg-warning directives for msp430 large memory model. * gcc.dg/tree-ssa/pr66449.c: Always use __INTPTR_TYPE__ when integer type equal in size to ptr_t is required. * gcc.dg/tree-ssa/ssa-dom-thread-8.c: Extend pointer size checking macro for msp430. * lib/target-supports.exp (check_effective_target_msp430_large_mem): New. --- gcc/doc/sourcebuild.texi | 8 ++++++ gcc/testsuite/gcc.c-torture/execute/991014-1.c | 7 ++++- gcc/testsuite/gcc.dg/Walloca-1.c | 4 +-- gcc/testsuite/gcc.dg/Walloca-2.c | 8 +++--- gcc/testsuite/gcc.dg/c99-const-expr-2.c | 2 ++ gcc/testsuite/gcc.dg/format/format.h | 6 ++-- gcc/testsuite/gcc.dg/lto/20081210-1_0.c | 8 +----- gcc/testsuite/gcc.dg/pr36227.c | 10 +------ gcc/testsuite/gcc.dg/pr42611.c | 3 +- gcc/testsuite/gcc.dg/pr78973.c | 2 +- .../gcc.dg/tree-ssa/builtin-sprintf-warn-3.c | 32 +++++++++++----------- gcc/testsuite/gcc.dg/tree-ssa/pr66449.c | 8 ++---- gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c | 8 +++--- gcc/testsuite/lib/target-supports.exp | 13 +++++++++ 14 files changed, 66 insertions(+), 53 deletions(-) diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index bfaa0fd..b5fac4e 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1941,6 +1941,14 @@ when using the new ABI. MIPS target supports @code{-mpaired-single}. @end table +@subsubsection MSP430-specific attributes + +@table @code +@item msp430_large_mem +The MSP430 large memory model (enabled with @code{-mlarge} compiler flag) +is in use. +@end table + @subsubsection PowerPC-specific attributes @table @code diff --git a/gcc/testsuite/gcc.c-torture/execute/991014-1.c b/gcc/testsuite/gcc.c-torture/execute/991014-1.c index e0bcd6d..95e38ce 100644 --- a/gcc/testsuite/gcc.c-torture/execute/991014-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/991014-1.c @@ -1,11 +1,16 @@ - typedef __SIZE_TYPE__ Size_t; +#ifdef __MSP430X_LARGE__ +/* size_t is __int20, so 20 bits, for __MSP430X_LARGE__, but __SIZEOF_POINTER__ + returns the bytesize which is 4. */ +#define bufsize ((1L << (20 - 2))-256) +#else /* !__MSP430X_LARGE__ */ #if __SIZEOF_LONG__ < __SIZEOF_POINTER__ #define bufsize ((1LL << (8 * sizeof(Size_t) - 2))-256) #else #define bufsize ((1L << (8 * sizeof(Size_t) - 2))-256) #endif +#endif struct huge_struct { diff --git a/gcc/testsuite/gcc.dg/Walloca-1.c b/gcc/testsuite/gcc.dg/Walloca-1.c index 85e9160..c9a6c57 100644 --- a/gcc/testsuite/gcc.dg/Walloca-1.c +++ b/gcc/testsuite/gcc.dg/Walloca-1.c @@ -24,8 +24,8 @@ void foo1 (size_t len, size_t len2, size_t len3) char *s = alloca (123); useit (s); // OK, constant argument to alloca - s = alloca (num); // { dg-warning "large due to conversion" "" { target lp64 } } - // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-1 } + s = alloca (num); // { dg-warning "large due to conversion" "" { target { { lp64 } || { msp430_large_mem } } } } + // { dg-warning "unbounded use of 'alloca'" "" { target { { ! lp64 } && { ! msp430_large_mem } } } .-1 } useit (s); s = alloca (30000); /* { dg-warning "is too large" } */ diff --git a/gcc/testsuite/gcc.dg/Walloca-2.c b/gcc/testsuite/gcc.dg/Walloca-2.c index 766ff8d..446c811 100644 --- a/gcc/testsuite/gcc.dg/Walloca-2.c +++ b/gcc/testsuite/gcc.dg/Walloca-2.c @@ -13,7 +13,7 @@ g1 (int n) // 32-bit targets because VRP is not giving us any range info for // the argument to __builtin_alloca. This should be fixed by the // upcoming range work. - p = __builtin_alloca (n); // { dg-bogus "unbounded use of 'alloca'" "" { xfail { ! lp64 } } } + p = __builtin_alloca (n); // { dg-bogus "unbounded use of 'alloca'" "" { xfail { { ! lp64 } && { ! msp430_large_mem } } } } else p = __builtin_malloc (n); f (p); @@ -36,9 +36,9 @@ g3 (int n) void *p; if (n > 0 && n < 3000) { - p = __builtin_alloca (n); // { dg-warning "'alloca' may be too large" "" { target lp64} } - // { dg-message "note:.*argument may be as large as 2999" "note" { target lp64 } .-1 } - // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-2 } + p = __builtin_alloca (n); // { dg-warning "'alloca' may be too large" "" { target { lp64 || msp430_large_mem } } } + // { dg-message "note:.*argument may be as large as 2999" "note" { target { lp64 || msp430_large_mem } } .-1 } + // { dg-warning "unbounded use of 'alloca'" "" { target { { ! lp64 } && { ! msp430_large_mem } } } .-2 } } else p = __builtin_malloc (n); diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-2.c b/gcc/testsuite/gcc.dg/c99-const-expr-2.c index a78e412..2b85706 100644 --- a/gcc/testsuite/gcc.dg/c99-const-expr-2.c +++ b/gcc/testsuite/gcc.dg/c99-const-expr-2.c @@ -18,6 +18,8 @@ long *c; #define ZERO 0L #elif defined(_WIN64) #define ZERO 0LL +#elif defined(__MSP430X_LARGE__) +#define ZERO (__int20)0 #else #define ZERO 0 #endif diff --git a/gcc/testsuite/gcc.dg/format/format.h b/gcc/testsuite/gcc.dg/format/format.h index a99927e..2d0a71b 100644 --- a/gcc/testsuite/gcc.dg/format/format.h +++ b/gcc/testsuite/gcc.dg/format/format.h @@ -58,12 +58,12 @@ __extension__ typedef unsigned int ullong __attribute__ ((mode (DI))); #else /* Kludges to get types corresponding to size_t and ptrdiff_t. */ #define unsigned signed -typedef __SIZE_TYPE__ signed_size_t; +__extension__ typedef __SIZE_TYPE__ signed_size_t; /* We also use this type to approximate ssize_t. */ -typedef __SIZE_TYPE__ ssize_t; +__extension__ typedef __SIZE_TYPE__ ssize_t; #undef unsigned #define signed /* Type might or might not have explicit 'signed'. */ -typedef unsigned __PTRDIFF_TYPE__ unsigned_ptrdiff_t; +__extension__ typedef unsigned __PTRDIFF_TYPE__ unsigned_ptrdiff_t; #undef signed __extension__ typedef long long int llong; diff --git a/gcc/testsuite/gcc.dg/lto/20081210-1_0.c b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c index 80a1e9a..8048b26 100644 --- a/gcc/testsuite/gcc.dg/lto/20081210-1_0.c +++ b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c @@ -1,10 +1,4 @@ -#if defined(_LP64) -typedef unsigned long int uintptr_t; -#elif defined (_WIN64) -typedef unsigned long long int uintptr_t; -#else -typedef unsigned int uintptr_t; -#endif +typedef __UINTPTR_TYPE__ uintptr_t; extern void srand (uintptr_t); diff --git a/gcc/testsuite/gcc.dg/pr36227.c b/gcc/testsuite/gcc.dg/pr36227.c index 27fe001..ba0d722 100644 --- a/gcc/testsuite/gcc.dg/pr36227.c +++ b/gcc/testsuite/gcc.dg/pr36227.c @@ -1,14 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Wstrict-overflow=3" } */ -#if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__) -typedef unsigned long long ptrcast; -#elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__) -typedef unsigned long ptrcast; -#elif (__SIZEOF_INT__ == __SIZEOF_POINTER__) -typedef unsigned int ptrcast; -#else -#error Add target support here -#endif +typedef __UINTPTR_TYPE__ ptrcast; volatile unsigned long * sat_add(volatile unsigned long *ptr, unsigned long i, volatile unsigned long *end) diff --git a/gcc/testsuite/gcc.dg/pr42611.c b/gcc/testsuite/gcc.dg/pr42611.c index 0426ce2..f502fea 100644 --- a/gcc/testsuite/gcc.dg/pr42611.c +++ b/gcc/testsuite/gcc.dg/pr42611.c @@ -3,7 +3,8 @@ /* { dg-options "" } */ #define L \ - (sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \ + (sizeof (__SIZE_TYPE__) == sizeof (void *) ? __INTPTR_MAX__ \ + : sizeof (__SIZE_TYPE__) == 1 ? __SCHAR_MAX__ \ : sizeof (__SIZE_TYPE__) == sizeof (short) ? __SHRT_MAX__ \ : sizeof (__SIZE_TYPE__) == sizeof (int) ? __INT_MAX__ \ : sizeof (__SIZE_TYPE__) == sizeof (long) ? __LONG_MAX__ \ diff --git a/gcc/testsuite/gcc.dg/pr78973.c b/gcc/testsuite/gcc.dg/pr78973.c index 6c53f89..e0148bbc 100644 --- a/gcc/testsuite/gcc.dg/pr78973.c +++ b/gcc/testsuite/gcc.dg/pr78973.c @@ -9,7 +9,7 @@ void f (void *p, int n) { if (n <= 4) - __builtin_memset (p, 0, n); /* { dg-warning "exceeds maximum object size" "pr79073" { xfail ilp32 } } */ + __builtin_memset (p, 0, n); /* { dg-warning "exceeds maximum object size" "pr79073" { xfail { ilp32 || { int16 && { ! msp430_large_mem } } } } } */ } void g (void *d, unsigned n) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c index d06248b..30a44a1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c @@ -357,35 +357,35 @@ void test_too_large (char *d, int x, __builtin_va_list va) const size_t imax_p1 = imax + 1; __builtin_snprintf (d, imax, "%c", x); - __builtin_snprintf (d, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin_snprintf (d, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large_mem } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { ilp32 } || { int16 && { ! msp430_large_mem } } } } .-1 } */ __builtin_vsnprintf (d, imax, "%c", va); - __builtin_vsnprintf (d, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin_vsnprintf (d, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large_mem } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { ilp32 } || { int16 && { ! msp430_large_mem } } } } .-1 } */ __builtin___snprintf_chk (d, imax, 0, imax, "%c", x); - __builtin___snprintf_chk (d, imax_p1, 0, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin___snprintf_chk (d, imax_p1, 0, imax_p1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large_mem } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { ilp32 } || { int16 && { ! msp430_large_mem } } } } .-1 } */ __builtin___vsnprintf_chk (d, imax, 0, imax, "%c", va); - __builtin___vsnprintf_chk (d, imax_p1, 0, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target lp64 } } */ - /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { avr-*-* } || ilp32 } } .-1 } */ + __builtin___vsnprintf_chk (d, imax_p1, 0, imax_p1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "INT_MAX + 1" { target { lp64 || msp430_large_mem } } } */ + /* { dg-warning "specified bound \[0-9\]+ exceeds maximum object size" "INT_MAX + 1" { target { { ilp32 } || { int16 && { ! msp430_large_mem } } } } .-1 } */ const size_t ptrmax = __PTRDIFF_MAX__; const size_t ptrmax_m1 = ptrmax - 1; - __builtin_snprintf (d, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin_snprintf (d, ptrmax, " %c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin_snprintf (d, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large_mem } } } */ + __builtin_snprintf (d, ptrmax, " %c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large_mem } } } */ - __builtin_vsnprintf (d, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin_vsnprintf (d, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin_vsnprintf (d, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large_mem } } } */ + __builtin_vsnprintf (d, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large_mem } } } */ - __builtin___snprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin___snprintf_chk (d, ptrmax, 0, ptrmax, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin___snprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large_mem } } } */ + __builtin___snprintf_chk (d, ptrmax, 0, ptrmax, "%c", x); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large_mem } } } */ - __builtin___vsnprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target lp64 } } */ - __builtin___vsnprintf_chk (d, ptrmax, 0, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target lp64 } } */ + __builtin___vsnprintf_chk (d, ptrmax_m1, 0, ptrmax_m1, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX - 1" { target { lp64 || msp430_large_mem } } } */ + __builtin___vsnprintf_chk (d, ptrmax, 0, ptrmax, "%c", va); /* { dg-warning "specified bound \[0-9\]+ exceeds .INT_MAX." "PTRDIFF_MAX" { target { lp64 || msp430_large_mem } } } */ } /* Exercise ordinary sprintf with malloc. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr66449.c b/gcc/testsuite/gcc.dg/tree-ssa/pr66449.c index cce26eb..3b6de12 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr66449.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr66449.c @@ -1,13 +1,11 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ -#if __SIZEOF_POINTER__ != __SIZEOF_LONG__ -#define long __INTPTR_TYPE__ -#endif +#define intptr_t __INTPTR_TYPE__ -void *fn1(void *p1, void *p2, long p3) +void *fn1(void *p1, void *p2, intptr_t p3) { - long a = (long)p1, b = (long)p2, c = p3; + intptr_t a = (intptr_t)p1, b = (intptr_t)p2, c = p3; while (c) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c index c456d73..bea0f89 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-8.c @@ -300,9 +300,9 @@ f2 (struct C *x) else { o = f2 (x); -#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ && !__MSP430X_LARGE__ if (((unsigned long) o > (unsigned long) -4000L)) -#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ +#else if (((__UINTPTR_TYPE__) o > (__UINTPTR_TYPE__) -4000U)) #endif { @@ -388,9 +388,9 @@ f2 (struct C *x) break; case 19: o = f2 (x); -#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ +#if __SIZEOF_POINTER__ == __SIZEOF_LONG__ && !__MSP430X_LARGE__ if (((unsigned long) o > (unsigned long) -4000L)) -#elif __SIZEOF_POINTER__ == __SIZEOF_INT__ +#else if (((__UINTPTR_TYPE__) o > (__UINTPTR_TYPE__) -4000U)) #endif { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d696fc6..7a714af 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1333,6 +1333,19 @@ proc check_effective_target_mips_eabi { } { }] } +# Return true if the MSP430 large memory model is enabled, i.e. the -mlarge +# command line flag has been passed. +proc check_effective_target_msp430_large_mem {} { + if { ![istarget msp430-*-*] } { + return 0 + } + return [check_no_compiler_messages msp430_large assembly { + #ifndef __MSP430X_LARGE__ + #error + #endif + } ""] +} + # Return 1 if the current multilib does not generate PIC by default. proc check_effective_target_nonpic { } { -- 2.7.4