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 jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
Date: Tue, 26 May 2020 22:07:25 +0000	[thread overview]
Message-ID: <bug-95306-4-cPj5hKaUHF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95306-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:bf40f0ba95037f235b007a55a7682646a0578b26

commit r11-647-gbf40f0ba95037f235b007a55a7682646a0578b26
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue May 26 09:28:16 2020 -0400

    jit: fix missing types for builtins [PR 95306]

    PR jit/95306 reports that attempts to use builtins
    __builtin_sadd_overflow" and "__builtin_memcpy" via
    gcc_jit_context_get_builtin_function lead to inscrutable error
    messages of the form:
      unimplemented primitive type for builtin: 42
    and:
      unimplemented primitive type for builtin: 38

    The root cause is that jit-builtins.c only implements a subset
    of the types defined via DEF_PRIMITIVE_TYPE in builtin-types.def.

    This patch:
    - implements enough types to enable the above two builtins to be
      referenced
    - documents gcc_jit_context_get_builtin_function, and notes the
      limitation that not all types are supported (supporting
      some of them would take a lot of extra work)
    - improves the error message for the unsupported cases
    - adds a testcase for __builtin_memcpy.  This required
      jit_langhook_global_bindings_p to be implemented (otherwise
      the assertion there failed deep inside "expand" on the builtin)
    - adds test coverage for the above

    gcc/jit/ChangeLog:
            PR jit/95306
            * docs/topics/functions.rst
            (gcc_jit_context_get_builtin_function): Document.
            * docs/_build/texinfo/libgccjit.texi: Regenerate.
            * dummy-frontend.c (jit_langhook_global_bindings_p): Remove
            gcc_unreachable.
            * jit-builtins.c (type_names): New array.
            (get_string_for_type_id): New function.
            (gcc::jit::builtins_manager::make_primitive_type): Show name of
            type in error messages.  Update cases to reflect the order in
            builtin-types.def.  Implement cases for BT_INT8, BT_INT16,
            BT_UINT8, BT_CONST_PTR, BT_VOLATILE_PTR, BT_INT_PTR, BT_FLOAT_PTR,
            BT_CONST_DOUBLE_PTR, BT_SIZE, BT_CONST_SIZE.

    gcc/testsuite/ChangeLog:
            PR jit/95306
            * jit.dg/all-non-failing-tests.h: Add test-builtin-memcpy.c and
            test-pr95306-builtin-types.c.
            * jit.dg/test-builtin-memcpy.c: New test.
            *
jit.dg/test-error-gcc_jit_context_get_builtin_function-unimplemented-type.c:
            New test.
            * jit.dg/test-pr95306-builtin-types.c: New test.

  parent reply	other threads:[~2020-05-26 22:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow " bouanto at zoho dot com
2020-05-26  0:13 ` [Bug jit/95306] Getting __builtin_sadd_overflow " bouanto at zoho dot com
2020-05-26 22:07 ` cvs-commit at gcc dot gnu.org [this message]
2020-05-26 22:27 ` dmalcolm at gcc dot gnu.org
2020-06-03 11:46 ` bouanto at zoho dot com
2020-06-03 15:15 ` cvs-commit at gcc dot gnu.org
2020-06-03 15:18 ` dmalcolm 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-95306-4-cPj5hKaUHF@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).