public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42"
@ 2020-05-24 15:21 bouanto at zoho dot com
  2020-05-26  0:13 ` [Bug jit/95306] Getting __builtin_sadd_overflow " bouanto at zoho dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bouanto at zoho dot com @ 2020-05-24 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95306
           Summary: Getting __builtin_saddl_overflow gives the error
                    "unimplemented primitive type for builtin: 42"
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: bouanto at zoho dot com
  Target Milestone: ---

Created attachment 48592
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48592&action=edit
Complete example reproducing this issue

Hi.
Getting the builtin __builtin_sadd_overflow like this:

    gcc_jit_function *sadd = gcc_jit_context_get_builtin_function(ctxt,
"__builtin_sadd_overflow");


prints the following error at runtime:

    unimplemented primitive type for builtin: 42

Other builtins like __builtin_saddl_overflow works fine.

Thanks to fix this issue.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
  2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" bouanto at zoho dot com
@ 2020-05-26  0:13 ` bouanto at zoho dot com
  2020-05-26 22:07 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bouanto at zoho dot com @ 2020-05-26  0:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from bouanto at zoho dot com ---
A similar error happens for the builtin "memcpy":

error: unimplemented primitive type for builtin: 38

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
  2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" 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
  2020-05-26 22:27 ` dmalcolm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-26 22:07 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
  2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" 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
@ 2020-05-26 22:27 ` dmalcolm at gcc dot gnu.org
  2020-06-03 11:46 ` bouanto at zoho dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-05-26 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Should be fixed by the above commit.

Note that not all builtins can supported (or, at least, it would be a lot of
extra work); see the commit message.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
  2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" bouanto at zoho dot com
                   ` (2 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: bouanto at zoho dot com @ 2020-06-03 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from bouanto at zoho dot com ---
Thanks for all your work.

I'm now facing this issue with the builtin __atomic_load:

libgccjit.so: error: unimplemented primitive type for builtin (type:
BT_CONST_VOLATILE_PTR)

Can you add support for this type as well, please?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
  2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" bouanto at zoho dot com
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-03 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:6d36cc21b69d952967a4df6653954f572a101796

commit r11-877-g6d36cc21b69d952967a4df6653954f572a101796
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed Jun 3 08:59:23 2020 -0400

    jit: implement BT_CONST_VOLATILE_PTR [PR 95306]

    gcc/jit/ChangeLog:
            PR jit/95306
            * jit-builtins.c (builtins_manager::make_primitive_type):
            Implement BT_CONST_VOLATILE_PTR.

    gcc/testsuite/ChangeLog:
            PR jit/95306
            * jit.dg/test-pr95306-builtin-types.c (create_code): Add
            test of getting __atomic_load.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug jit/95306] Getting __builtin_sadd_overflow gives the error "unimplemented primitive type for builtin: 42"
  2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" bouanto at zoho dot com
                   ` (4 preceding siblings ...)
  2020-06-03 15:15 ` cvs-commit at gcc dot gnu.org
@ 2020-06-03 15:18 ` dmalcolm at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-06-03 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I've added the type; hopefully the builtin works as expected.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-06-03 15:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24 15:21 [Bug jit/95306] New: Getting __builtin_saddl_overflow gives the error "unimplemented primitive type for builtin: 42" 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
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

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).