public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Sandiford <rdsandiford@googlemail.com>
Subject: Re: [committed] PR 61095: tsan fallout from wide-int merge
Date: Thu, 08 May 2014 07:56:00 -0000	[thread overview]
Message-ID: <CAFiYyc1e2aYpKiPfw2VimpLTVGaEmMdtJBAuhUkTOQczNhVTSw@mail.gmail.com> (raw)
In-Reply-To: <874n104sod.fsf@talisman.default>

On Thu, May 8, 2014 at 9:48 AM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> Richard Sandiford <rdsandiford@googlemail.com> writes:
>> This PR was due to code in which -(int) foo was suposed to be sign-extended,
>> but was being ORed with an unsigned int and so ended up being zero-extended.
>> Fixed by using the proper-width type.
>
> As Kostya rightly said in the PR, this should have had a testcase too.
>
> Tested on x86_64-linux-gnu.  It failed before the patch on x86_64,
> passes after it, and is skipped for -m32.  OK to install?

Ok.

Thanks,
Richard.

> Thanks,
> Richard
>
>
> gcc/testsuite/
>         PR tree-optimization/61095
>         * gcc.dg/torture/pr61095.c: New test.
>
> Index: gcc/testsuite/gcc.dg/torture/pr61095.c
> ===================================================================
> --- /dev/null   2014-05-03 11:58:38.033951363 +0100
> +++ gcc/testsuite/gcc.dg/torture/pr61095.c      2014-05-08 08:46:01.203827892 +0100
> @@ -0,0 +1,23 @@
> +/* { dg-do run } */
> +/* { dg-require-effective-target lp64 } */
> +
> +extern void __attribute__ ((noreturn)) abort (void);
> +
> +int __attribute__ ((noinline, noclone))
> +foo (unsigned long addr) {
> +    unsigned long *p = (unsigned long*)((addr & 0xffff83fffffffff8UL) * 4);
> +    unsigned long xxx = (unsigned long)(p + 1);
> +    return xxx >= 0x3c000000000UL;
> +}
> +
> +int
> +main (void)
> +{
> +  if (foo (0))
> +    abort ();
> +  if (foo (0x7c0000000000UL))
> +    abort ();
> +  if (!foo (0xfc0000000000UL))
> +    abort ();
> +  return 0;
> +}

      reply	other threads:[~2014-05-08  7:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 18:01 Richard Sandiford
2014-05-08  7:48 ` Richard Sandiford
2014-05-08  7:56   ` Richard Biener [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=CAFiYyc1e2aYpKiPfw2VimpLTVGaEmMdtJBAuhUkTOQczNhVTSw@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rdsandiford@googlemail.com \
    /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).