public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: Georg-Johann Lay <avr@gjlay.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [testsuite,committed] Fix prototype of memset in a test case.
Date: Fri, 23 Dec 2016 18:48:00 -0000	[thread overview]
Message-ID: <8737hele0b.fsf@googlemail.com> (raw)
In-Reply-To: <09bf19f1-c438-e95c-43d2-863199e65121@gjlay.de> (Georg-Johann	Lay's message of "Fri, 23 Dec 2016 11:33:47 +0100")

Georg-Johann Lay <avr@gjlay.de> writes:
> On 22.12.2016 19:20, Richard Sandiford wrote:
>> Georg-Johann Lay <avr@gjlay.de> writes:
>>> One test case used unsigned long for the 3rd parameter of memset, which
>>> should be size_t.  This made the test crash for targets where correct
>>> parameter passing depends on correct prototypes.
>>>
>>> Fixed and committed as obvious.
>>
>> Catching up on backlog, but... I'm not sure this counts as obvious
>> if the crash was an ICE.  We should at least fail gracefully.
>
> The crash I mentioned happened on avr where parameter passing needs
> correct prototypes.  The code crashed when executed on avr because
> a long gets passed in regs R22..R25 (LSBs first) but a size_t is
> passed in R24..R25.  Hence the implementation of memset would pick
> up the upper two bytes of the length (zero) which crashes when run.

Ah, OK, so it was the test executable that crashed and not the compiler.
In that case sorry for the noise.

Richard

> PR30778 was about wrong-code because more than the specified number
> of bytes were written.  It was reported for x64_64 where we have
> size_t = unsigned long, hence the change is a no-op on the platform
> the PR was originally reported against (similar for x86 where
> size_t = unsigned).
>
> Moreover, the test case is condensed from GCC's combine.c and I'd
> expect that GCC's header are using correct prototypes :-)
>
> Johann
>
>>
>> Thanks,
>> Richard
>>
>>>
>>> Johann
>>>
>>>
>>> gcc/testsuite/
>>> 	* gcc.c-torture/execute/pr30778.c (memset): Use size_t for 3rd
>>> 	parameter in declaration.
>>>
>>> Index: gcc.c-torture/execute/pr30778.c
>>> ===================================================================
>>> --- gcc.c-torture/execute/pr30778.c     (revision 242541)
>>> +++ gcc.c-torture/execute/pr30778.c     (working copy)
>>> @@ -1,4 +1,4 @@
>>> -extern void *memset (void *, int, unsigned long);
>>> +extern void *memset (void *, int, __SIZE_TYPE__);
>>>   extern void abort (void);
>>>
>>>   struct reg_stat {
>>

      reply	other threads:[~2016-12-23 18:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22 15:32 Georg-Johann Lay
2016-12-22 19:09 ` Richard Sandiford
2016-12-23 11:04   ` Georg-Johann Lay
2016-12-23 18:48     ` Richard Sandiford [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737hele0b.fsf@googlemail.com \
    --to=rdsandiford@googlemail.com \
    --cc=avr@gjlay.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).