From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81397 invoked by alias); 22 Feb 2018 11:00:03 -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 81337 invoked by uid 89); 22 Feb 2018 11:00:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=maxsize X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 11:00:00 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1eoobV-0006qE-Mw from Tom_deVries@mentor.com ; Thu, 22 Feb 2018 02:59:57 -0800 Received: from [172.30.72.140] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 22 Feb 2018 10:59:53 +0000 Subject: Re: [PATCH][committed] Fix ICE in maybe_record_trace_start To: Jeff Law , gcc-patches References: From: Tom de Vries Message-ID: <42ee114a-655b-8b46-f511-e423fc08af97@mentor.com> Date: Thu, 22 Feb 2018 11:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-SW-Source: 2018-02/txt/msg01267.txt.bz2 On 02/12/2018 07:32 PM, Jeff Law wrote: > diff --git a/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c b/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c > new file mode 100644 > index 00000000000..0ca0b9f034b > --- /dev/null > +++ b/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c > @@ -0,0 +1,36 @@ > +int foo; > +typedef long unsigned int size_t; > +typedef short unsigned int wchar_t; > +struct tm > +{ > + int tm_mday; > + int tm_mon; > + int tm_year; > +}; > +size_t > +__strftime (wchar_t * s, size_t maxsize, const wchar_t * format, const struct tm *tim_p) > +{ > + size_t count = 0; > + int len = 0; > + size_t i, ctloclen; > + unsigned long width; > + { > + if (foo) > + { > + { > + wchar_t *fmt = L"%s%.*d"; > + len = swprintf (&s[count], maxsize, fmt, "-", width, 0); > + } > + if ((count) >= maxsize) > + return 0; > + } > + else > + { > + len = > + swprintf (&s[count], maxsize - count, L"%.2d/%.2d/%.2d", 42, 99, 0); > + if ((count) >= maxsize) > + return 0; > + > + } > + } > +} Hi, when compiling this test for nvptx, the missing declaration for swprintf results in this default declaration in the .s file based on the arguments of the first call: ... .extern .func (.param.u32 %value_out) swprintf (.param.u64 %in_ar0, .param.u64 %in_ar1, .param.u64 %in_ar2, .param.u64 %in_ar3, .param.u64 %in_ar4, .param.u32 %in_ar5); ... and this error message when ptxas process the second call: ... ptxas regs-arg-size.o, line 97; error : Type or alignment of argument does not match formal parameter '%in_ar3' ptxas regs-arg-size.o, line 97; error : Type or alignment of argument does not match formal parameter '%in_ar4' ptxas fatal : Ptx assembly aborted due to errors nvptx-as: ptxas returned 255 exit status ... When adding a declaration in the source like so: ... diff --git a/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c b/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c index 0ca0b9f034b..81943a2c459 100644 --- a/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c +++ b/gcc/testsuite/gcc.c-torture/compile/regs-arg-size.c @@ -1,6 +1,7 @@ int foo; typedef long unsigned int size_t; typedef short unsigned int wchar_t; +extern int swprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...); struct tm { int tm_mday; ... the declaration changes to: ... .extern .func (.param.u32 %value_out) swprintf (.param.u64 %in_ar0, .param.u64 %in_ar1, .param.u64 %in_ar2, .param.u64 %in_ar3); ... and test test-case passes. Is it ok to update the test-case like this, or should it require effective target 'untyped_assembly' (which is false for nvptx). Thanks, - Tom