public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/100316] [11/12 Regression] __clear_cache() does not support NULL-pointer arguments
Date: Mon, 11 Oct 2021 06:15:31 +0000	[thread overview]
Message-ID: <bug-100316-4-d5oK5EU6bp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100316-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100316

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kito Cheng <kito@gcc.gnu.org>:

https://gcc.gnu.org/g:4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d

commit r12-4281-g4e5bc4e4506a7ae7bb88fc925a425652a1da6b2d
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Thu Oct 7 16:17:13 2021 +0800

    [PR/target 100316] Allow constant address for __builtin___clear_cache.

    __builtin___clear_cache was able to accept constant address for the
    argument, but it seems no longer accept recently, and it even not
    accept constant address which is hold in variable when optimization is
    enable:

    ```
    void foo3(){
      void *yy = (void*)0x1000;
      __builtin___clear_cache(yy, yy);
    }
    ```

    So this patch make BEGIN and END accept VOIDmode, like cselib_lookup_mem
did per
    Jim Wilson's suggestion.

    ```
    static cselib_val *
    cselib_lookup_mem (rtx x, int create)
    {
      ...
      addr_mode = GET_MODE (XEXP (x, 0));
      if (addr_mode == VOIDmode)
        addr_mode = Pmode;
    ```

    Changes v2 -> v3:
    - Use gcc_assert rather than error, maybe_emit_call_builtin___clear_cache
is
    internal use only, and we already checked the type in other place.

    Changes v1 -> v2:
    - Check is CONST_INT intead of cehck mode, no new testcase, since
      constant value with other type like CONST_DOUBLE will catched by
      front-end.
    e.g.
    Code:
    ```c
    void foo(){
      __builtin___clear_cache(1.11, 0);
    }
    ```
    Error message:
    ```
    clearcache-double.c: In function 'foo':
    clearcache-double.c:2:27: error: incompatible type for argument 1 of
'__builtin___clear_cache'
        2 |   __builtin___clear_cache(1.11, 0);
          |                           ^~~~
          |                           |
          |                           double
    clearcache-double.c:2:27: note: expected 'void *' but argument is of type
'double'
    ```

    gcc/ChangeLog:

            PR target/100316
            * builtins.c (maybe_emit_call_builtin___clear_cache): Allow
            CONST_INT for BEGIN and END, and use gcc_assert rather than
            error.

    gcc/testsuite/ChangeLog:

            PR target/100316
            * gcc.c-torture/compile/pr100316.c: New.

  parent reply	other threads:[~2021-10-11  6:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 12:35 [Bug target/100316] New: Regression: " christophm30 at gmail dot com
2021-04-28 21:23 ` [Bug target/100316] " wilson at gcc dot gnu.org
2021-10-07 10:31 ` [Bug middle-end/100316] [11/12 Regression] " pinskia at gcc dot gnu.org
2021-10-11  6:15 ` cvs-commit at gcc dot gnu.org [this message]
2021-10-11  6:28 ` kito at gcc dot gnu.org
2021-10-18 16:05 ` cvs-commit at gcc dot gnu.org
2021-10-18 16:06 ` kito at gcc dot gnu.org

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=bug-100316-4-d5oK5EU6bp@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).