From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62254 invoked by alias); 11 Aug 2017 21:22:24 -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 62235 invoked by uid 89); 11 Aug 2017 21:22:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:4878 X-HELO: sasl.smtp.pobox.com Received: from pb-smtp2.pobox.com (HELO sasl.smtp.pobox.com) (64.147.108.71) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Aug 2017 21:22:20 +0000 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id B04C9A9E8F; Fri, 11 Aug 2017 17:22:17 -0400 (EDT) Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id A8B77A9E8E; Fri, 11 Aug 2017 17:22:17 -0400 (EDT) Received: from loudmouth.attlocal.net (unknown [76.215.41.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id A8E81A9E8A; Fri, 11 Aug 2017 17:22:16 -0400 (EDT) From: Daniel Santos To: gcc-patches , Uros Bizjak , "H . J . Lu" , Mike Stump Cc: Rainer Orth Subject: [PATCH] [i386,testsuite] [PR 71958] Error on -mx32 with -mabi=ms Date: Sat, 12 Aug 2017 01:32:00 -0000 Message-Id: <20170811212744.30180-1-daniel.santos@pobox.com> X-Pobox-Relay-ID: 26B48066-7EDB-11E7-8F0F-9D2B0D78B957-06139138!pb-smtp2.pobox.com X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00827.txt.bz2 We currently error when -mx32 -mabi=sysv and we encounter a function with attribute ms_abi, but we are not erroring on -mx32 and -mabi=ms (either explicitly or when it is the default on Windows). In fact, it generates code that runs, but is of an undfined ABI. I'm running -m64 and -m32 tests now and will run x32 tests when those are done. Presuming that I've corrected all existing tests that do not filter out x32 target and there are no additional failures, is this OK for head? Thanks, Daniel gcc/ChangeLog: 2017-08-11 Daniel Santos * config/i386/i386.c (ix86_option_override_internal): Modify. (ix86_function_type_abi): Likewise. gcc/testsuite/ChangeLog: 2017-08-11 Daniel Santos * gcc.target/i386/pr71958.c: New test. * gcc.target/i386/pr64409.c: Modify to skip on Windows. * gcc.target/i386/pr46470.c: Modify to skip x32 target. * gcc.target/i386/pr66275.c: Likewise. * gcc.target/i386/pr68018.c: Likewise. Signed-off-by: Daniel Santos --- gcc/config/i386/i386.c | 11 +++++++++-- gcc/testsuite/gcc.target/i386/pr46470.c | 2 +- gcc/testsuite/gcc.target/i386/pr64409.c | 3 ++- gcc/testsuite/gcc.target/i386/pr66275.c | 2 +- gcc/testsuite/gcc.target/i386/pr68018.c | 2 +- gcc/testsuite/gcc.target/i386/pr71958.c | 8 ++++++++ 6 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr71958.c diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b04321a8d40..311a52c2a1f 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5585,6 +5585,9 @@ ix86_option_override_internal (bool main_args_p, if (TARGET_X32_P (opts->x_ix86_isa_flags)) { + if (opts_set->x_ix86_abi == MS_ABI) + error ("-mx32 not supported with -mabi=ms"); + /* Always turn on OPTION_MASK_ISA_64BIT and turn off OPTION_MASK_ABI_64 for TARGET_X32. */ opts->x_ix86_isa_flags |= OPTION_MASK_ISA_64BIT; @@ -8777,8 +8780,12 @@ ix86_function_type_abi (const_tree fntype) if (abi == SYSV_ABI && lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype))) { - if (TARGET_X32) - error ("X32 does not support ms_abi attribute"); + static int warned; + if (TARGET_X32 && !warned) + { + error ("X32 does not support ms_abi attribute"); + warned = 1; + } abi = MS_ABI; } diff --git a/gcc/testsuite/gcc.target/i386/pr46470.c b/gcc/testsuite/gcc.target/i386/pr46470.c index 9e8e731188e..c66a378a1ad 100644 --- a/gcc/testsuite/gcc.target/i386/pr46470.c +++ b/gcc/testsuite/gcc.target/i386/pr46470.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { ! x32 } } } */ /* The pic register save adds unavoidable stack pointer references. */ /* { dg-skip-if "" { ia32 && { ! nonpic } } } */ /* These options are selected to ensure 1 word needs to be allocated diff --git a/gcc/testsuite/gcc.target/i386/pr64409.c b/gcc/testsuite/gcc.target/i386/pr64409.c index 917472653f4..3dbd9a09f01 100644 --- a/gcc/testsuite/gcc.target/i386/pr64409.c +++ b/gcc/testsuite/gcc.target/i386/pr64409.c @@ -1,6 +1,7 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-require-effective-target maybe_x32 } */ /* { dg-options "-O0 -mx32" } */ +/* { xfail { "*-*-cygwin* *-*-mingw*" } } */ int a; -int* __attribute__ ((ms_abi)) fn1 () { return &a; } /* { dg-error "X32 does not support ms_abi attribute" } */ +int* __attribute__ ((ms_abi)) fn1 () { return &a; } /* { dg-error "X32 does not support ms_abi attribute" { target { ! "*-*-mingw* *-*-cygwin*" } } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr66275.c b/gcc/testsuite/gcc.target/i386/pr66275.c index b8759aeb5ec..a1271857f6a 100644 --- a/gcc/testsuite/gcc.target/i386/pr66275.c +++ b/gcc/testsuite/gcc.target/i386/pr66275.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-do compile { target { *-*-linux* && { ! { ia32 || x32 } } } } } */ /* { dg-options "-mabi=ms -fdump-rtl-dfinit" } */ void diff --git a/gcc/testsuite/gcc.target/i386/pr68018.c b/gcc/testsuite/gcc.target/i386/pr68018.c index a0fa21e0b00..871fdddf643 100644 --- a/gcc/testsuite/gcc.target/i386/pr68018.c +++ b/gcc/testsuite/gcc.target/i386/pr68018.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-do compile { target { *-*-linux* && { ! { ia32 || x32 } } } } } */ /* { dg-options "-O -mabi=ms -mstackrealign" } */ typedef float V __attribute__ ((vector_size (16))); diff --git a/gcc/testsuite/gcc.target/i386/pr71958.c b/gcc/testsuite/gcc.target/i386/pr71958.c new file mode 100644 index 00000000000..090d1970ca9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr71958.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-mx32 -mabi=ms" } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-excess-errors "not supported" } */ + +void main () +{ +} -- 2.13.3