From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 15E34394800C; Tue, 26 May 2020 22:07:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15E34394800C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590530846; bh=MGeBOo7C3tkfViNtWK34Y/mtxA5uYfY2LjcXh0lnedk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DTVGVxi/3K91SzE4tiSc2uAm3anNrYzQt/LE7mqeD3NrZ/2dOXHSO8XZVa+Dvu92V PfYOHMV7KxeNMLAst7eBUQu5YOLWhFKqde1uLI0cYOu+WFHxdyPM4uZzfQ9VCE/5mY leu3qdWAGoEDyzfuWQiXEe9YZos9kGmwhnBd3AVA= From: "cvs-commit at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: jit X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 May 2020 22:07:26 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95306 --- Comment #2 from CVS Commits --- The master branch has been updated by David Malcolm : https://gcc.gnu.org/g:bf40f0ba95037f235b007a55a7682646a0578b26 commit r11-647-gbf40f0ba95037f235b007a55a7682646a0578b26 Author: David Malcolm 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_P= TR, 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.=