public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>,
	       gcc-patches@gcc.gnu.org
Cc: ro@CeBiTec.Uni-Bielefeld.DE, mikestump@comcast.net
Subject: Re: [Patch, testsuite] Skip addr_equal-1 if target keeps null pointer checks
Date: Mon, 28 Sep 2015 21:20:00 -0000	[thread overview]
Message-ID: <5609972A.2020001@redhat.com> (raw)
In-Reply-To: <20150928081559.GB14913@jaguar.corp.atmel.com>

On 09/28/2015 02:15 AM, Senthil Kumar Selvaraj wrote:
> Hi,
>
>    The below patch skips gcc.dg/addr_equal-1.c if the target keeps null
>    pointer checks.
>
>    The test fails for such targets (avr, in my case) because the address
>    comparison in the below code does not resolve to a constant, causing
>    builtin_constant_p to return false and fail the test.
>
>    /* Variables and functions do not share same memory locations otherwise.  */
>    if (!__builtin_constant_p ((void *)undef_fn0 == (void *)&undef_var0))
>      abort ();
>
>    For targets that delete null pointer checks, the equality comparison expression
>    is optimized away to 0, as the code in match.pd knows they can only be
>    equal if they are both NULL, which cannot be true since
>    flag-delete-null-pointer-checks is on.
>
>    For targets that keep null pointer checks, 0 is a valid address and the
> 	comparison expression is left as is, and that causes a later pass to
> 	fold the builtin_constant_p to a false value, resulting in the test failure.
This sounds like a failing in the compiler itself, not a testsuite issue.

Even on a target where objects can be at address 0, you can't have a 
variable and a function at the same address.

Jeff

  parent reply	other threads:[~2015-09-28 19:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28  8:26 Senthil Kumar Selvaraj
2015-09-28 19:38 ` Mike Stump
2015-09-28 21:20 ` Jeff Law [this message]
2015-09-29  8:18   ` Senthil Kumar Selvaraj
2015-09-30 18:59     ` Jeff Law
2015-09-30 19:22       ` Jan Hubicka

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=5609972A.2020001@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    --cc=senthil_kumar.selvaraj@atmel.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).