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 target/96991] [nvptx] internal compiler error: in write_fn_proto, at config/nvptx/nvptx.c:913
Date: Wed, 09 Sep 2020 12:34:18 +0000	[thread overview]
Message-ID: <bug-96991-4-bySbqwI0MN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96991-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@gcc.gnu.org>:

https://gcc.gnu.org/g:505590b796df18ec3fcdcd6b8060f6f1410660b2

commit r11-3073-g505590b796df18ec3fcdcd6b8060f6f1410660b2
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Sep 9 09:51:43 2020 +0200

    [nvptx] Fix boolean type test in write_fn_proto

    When running this libgomp testcase for nvptx accelerator:
    ...
    /* { dg-do run } */
    __uint128_t v;
    int main () {
      #pragma omp target
      {
        __uint128_t exp = 2;
        __atomic_compare_exchange_n (&v, &exp, 7, false, __ATOMIC_RELEASE,
                                     __ATOMIC_ACQUIRE);
      }
    }
    ...
    we run into this assert in write_fn_proto:
    ...
    913             gcc_assert (type == boolean_type_node);
    ...

    This happens when doing some special-handling code for
    __atomic_compare_exchange_1/2/4/8/16.  The function decls have a parameter
    called weak of type bool, which is skipped when writing the decl because
    the corresponding libatomic functions do not have that parameter.  The
assert
    is there to verify that we skip the correct parameter.

    However, we assert because we have different type of bools:
    ...
    (gdb) call debug_generic_expr (type)
    _Bool
    (gdb) call debug_generic_expr (global_trees[TI_BOOLEAN_TYPE])
    bool
    ...

    Fix this by checking for TREE_CODE (type) == BOOLEAN_TYPE instead.

    Tested libgomp on x86_64-linux with nvptx accelerator.

    Likewise, tested that the test-case above does not ICE anymore.

    gcc/ChangeLog:

            PR target/96991
            * config/nvptx/nvptx.c (write_fn_proto): Fix boolean type check.

  parent reply	other threads:[~2020-09-09 12:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09  7:41 [Bug target/96991] New: " vries at gcc dot gnu.org
2020-09-09  7:44 ` [Bug target/96991] " vries at gcc dot gnu.org
2020-09-09  7:49 ` vries at gcc dot gnu.org
2020-09-09  8:22 ` jakub at gcc dot gnu.org
2020-09-09 10:03 ` vries at gcc dot gnu.org
2020-09-09 12:34 ` cvs-commit at gcc dot gnu.org [this message]
2020-09-09 12:36 ` vries 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-96991-4-bySbqwI0MN@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).