* Re: [Bug jit/99126] New: Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
@ 2021-02-16 20:26 ` Andrea Corallo
2021-02-16 20:26 ` [Bug jit/99126] " andrea.corallo at arm dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Andrea Corallo @ 2021-02-16 20:26 UTC (permalink / raw)
To: akrl at gcc dot gnu.org via Gcc-bugs; +Cc: akrl at gcc dot gnu.org
This is the bt of how the C front-end is initializing these
declarations:
#0 set_builtin_decl (implicit_p=<optimized out>,
decl=<function_decl 0x7ffff72a0800 __builtin_return_address>,
fncode=<optimized out>) at ../../gcc/tree.h:5662
#1 def_builtin_1 (fncode=<optimized out>, name=<optimized out>,
fntype=<optimized out>, libtype=<tree 0x0>, both_p=<optimized out>,
fallback_p=<optimized out>, nonansi_p=false,
fnattrs=<tree_list 0x7ffff7204f78>, implicit_p=true, fnclass=BUILT_IN_NORMAL)
at ../../gcc/c-family/c-common.c:4729
#2 0x0000000000a291c9 in c_define_builtins (
va_list_arg_type_node=<optimized out>, va_list_ref_type_node=<optimized out>)
at ../../gcc/builtins.def:933
Thinking loud: I guess in jit-builtins.c we should loop once over all
the builtins calling 'set_builtin_decl'? Probably in the constructor
for gcc::jit::builtins_manager?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
2021-02-16 20:26 ` Andrea Corallo
@ 2021-02-16 20:26 ` andrea.corallo at arm dot com
2021-02-17 8:18 ` marxin at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: andrea.corallo at arm dot com @ 2021-02-16 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #1 from Andrea Corallo <andrea.corallo at arm dot com> ---
This is the bt of how the C front-end is initializing these
declarations:
#0 set_builtin_decl (implicit_p=<optimized out>,
decl=<function_decl 0x7ffff72a0800 __builtin_return_address>,
fncode=<optimized out>) at ../../gcc/tree.h:5662
#1 def_builtin_1 (fncode=<optimized out>, name=<optimized out>,
fntype=<optimized out>, libtype=<tree 0x0>, both_p=<optimized out>,
fallback_p=<optimized out>, nonansi_p=false,
fnattrs=<tree_list 0x7ffff7204f78>, implicit_p=true,
fnclass=BUILT_IN_NORMAL)
at ../../gcc/c-family/c-common.c:4729
#2 0x0000000000a291c9 in c_define_builtins (
va_list_arg_type_node=<optimized out>, va_list_ref_type_node=<optimized
out>)
at ../../gcc/builtins.def:933
Thinking loud: I guess in jit-builtins.c we should loop once over all
the builtins calling 'set_builtin_decl'? Probably in the constructor
for gcc::jit::builtins_manager?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
2021-02-16 20:26 ` Andrea Corallo
2021-02-16 20:26 ` [Bug jit/99126] " andrea.corallo at arm dot com
@ 2021-02-17 8:18 ` marxin at gcc dot gnu.org
2021-02-18 0:07 ` dmalcolm at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-17 8:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-02-17
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
CC| |marxin at gcc dot gnu.org
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Thanks for the report.
> This is my understanding of what is going on here: we have a some
> generated code that in GIMPLE is proved to dereference a null pointer
> (BTW this code should be unreachable).
That's fine.
>
> MEM[(struct comp_Lisp_Cons *)0B].u.s.car = _35;
>
So I guess JIT should really initialize the builtins.
I tried manually calling:
gcc_jit_context_get_builtin_function (ctxt_0x8892590, "__builtin_trap");
and then your reproducer is fine.
Leaving to David.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (2 preceding siblings ...)
2021-02-17 8:18 ` marxin at gcc dot gnu.org
@ 2021-02-18 0:07 ` dmalcolm at gcc dot gnu.org
2021-02-18 21:07 ` dmalcolm at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-02-18 0:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 50216
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50216&action=edit
Minimal reproducer as a test case
Attached is a minimal reproducer, as a test case. I don't have a fix for this
yet.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (3 preceding siblings ...)
2021-02-18 0:07 ` dmalcolm at gcc dot gnu.org
@ 2021-02-18 21:07 ` dmalcolm at gcc dot gnu.org
2021-02-18 21:19 ` Andrea Corallo
2021-02-18 21:19 ` andrea.corallo at arm dot com
` (5 subsequent siblings)
10 siblings, 1 reply; 14+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-02-18 21:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Am testing a fix.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Bug jit/99126] Compilation ICE trying insert trap
2021-02-18 21:07 ` dmalcolm at gcc dot gnu.org
@ 2021-02-18 21:19 ` Andrea Corallo
0 siblings, 0 replies; 14+ messages in thread
From: Andrea Corallo @ 2021-02-18 21:19 UTC (permalink / raw)
To: dmalcolm at gcc dot gnu.org via Gcc-bugs; +Cc: dmalcolm at gcc dot gnu.org
"dmalcolm at gcc dot gnu.org via Gcc-bugs" <gcc-bugs@gcc.gnu.org>
writes:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
>
> David Malcolm <dmalcolm at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEW |ASSIGNED
>
> --- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
> Am testing a fix.
Nice!
As a side question: do you guys think disabling "isolate-paths" is the
right workaround for the affected versions or might have harmful side
effects?
Thanks
Andrea
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (4 preceding siblings ...)
2021-02-18 21:07 ` dmalcolm at gcc dot gnu.org
@ 2021-02-18 21:19 ` andrea.corallo at arm dot com
2021-02-19 2:29 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: andrea.corallo at arm dot com @ 2021-02-18 21:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #5 from Andrea Corallo <andrea.corallo at arm dot com> ---
"dmalcolm at gcc dot gnu.org via Gcc-bugs" <gcc-bugs@gcc.gnu.org>
writes:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
>
> David Malcolm <dmalcolm at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Status|NEW |ASSIGNED
>
> --- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
> Am testing a fix.
Nice!
As a side question: do you guys think disabling "isolate-paths" is the
right workaround for the affected versions or might have harmful side
effects?
Thanks
Andrea
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (5 preceding siblings ...)
2021-02-18 21:19 ` andrea.corallo at arm dot com
@ 2021-02-19 2:29 ` cvs-commit at gcc dot gnu.org
2021-02-19 2:34 ` dmalcolm at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-19 2:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #6 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:b258e263e0d74ca1f76aeaac5f4d1abef6b13707
commit r11-7288-gb258e263e0d74ca1f76aeaac5f4d1abef6b13707
Author: David Malcolm <dmalcolm@redhat.com>
Date: Thu Feb 18 21:28:26 2021 -0500
jit: fix ICE on BUILT_IN_TRAP [PR99126]
gcc/jit/ChangeLog:
PR jit/99126
* jit-builtins.c
(gcc::jit::builtins_manager::get_builtin_function_by_id):
Update assertion to reject BUILT_IN_NONE.
(gcc::jit::builtins_manager::ensure_optimization_builtins_exist):
New.
* jit-builtins.h
(gcc::jit::builtins_manager::ensure_optimization_builtins_exist):
New decl.
* jit-playback.c (gcc::jit::playback::context::replay): Call it.
Remove redundant conditional on bm.
gcc/testsuite/ChangeLog:
PR jit/99126
* jit.dg/test-trap.c: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (6 preceding siblings ...)
2021-02-19 2:29 ` cvs-commit at gcc dot gnu.org
@ 2021-02-19 2:34 ` dmalcolm at gcc dot gnu.org
2021-02-19 2:35 ` dmalcolm at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-02-19 2:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Andrea Corallo from comment #5)
> As a side question: do you guys think disabling "isolate-paths" is the
> right workaround for the affected versions or might have harmful side
> effects?
It ought to stop the crash; given that the code path happens on places where
the compiler predicts a NULL dereference, I don't think it can cause additional
problems.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (7 preceding siblings ...)
2021-02-19 2:34 ` dmalcolm at gcc dot gnu.org
@ 2021-02-19 2:35 ` dmalcolm at gcc dot gnu.org
2021-02-22 13:29 ` Andrea Corallo
2021-02-22 13:29 ` andrea.corallo at arm dot com
2024-06-25 23:34 ` pinskia at gcc dot gnu.org
10 siblings, 1 reply; 14+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-02-19 2:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #8 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to CVS Commits from comment #6)
> The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:
>
> https://gcc.gnu.org/g:b258e263e0d74ca1f76aeaac5f4d1abef6b13707
>
> commit r11-7288-gb258e263e0d74ca1f76aeaac5f4d1abef6b13707
Fixed on trunk for gcc 11. Andrea, do you need my to backport this? What GCC
versions are you targeting with your emacs project?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (8 preceding siblings ...)
2021-02-19 2:35 ` dmalcolm at gcc dot gnu.org
@ 2021-02-22 13:29 ` andrea.corallo at arm dot com
2024-06-25 23:34 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 14+ messages in thread
From: andrea.corallo at arm dot com @ 2021-02-22 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
--- Comment #9 from Andrea Corallo <andrea.corallo at arm dot com> ---
"dmalcolm at gcc dot gnu.org via Gcc-bugs" <gcc-bugs@gcc.gnu.org>
writes:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
>
> --- Comment #8 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
> (In reply to CVS Commits from comment #6)
>> The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:
>>
>> https://gcc.gnu.org/g:b258e263e0d74ca1f76aeaac5f4d1abef6b13707
>>
>> commit r11-7288-gb258e263e0d74ca1f76aeaac5f4d1abef6b13707
>
> Fixed on trunk for gcc 11. Andrea, do you need my to backport this? What GCC
> versions are you targeting with your emacs project?
We are targetting them all, but to my test I could not trigger this bug
on GCC9 so I guess we could backport on GCC10 only?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug jit/99126] Compilation ICE trying insert trap
2021-02-16 19:42 [Bug jit/99126] New: Compilation ICE trying insert trap akrl at gcc dot gnu.org
` (9 preceding siblings ...)
2021-02-22 13:29 ` andrea.corallo at arm dot com
@ 2024-06-25 23:34 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25 23:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99126
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |11.0
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed. GCC 10.x is no longer supported.
^ permalink raw reply [flat|nested] 14+ messages in thread