public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/99126] New: Compilation ICE trying insert trap
@ 2021-02-16 19:42 akrl at gcc dot gnu.org
  2021-02-16 20:26 ` Andrea Corallo
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: akrl at gcc dot gnu.org @ 2021-02-16 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99126
           Summary: Compilation ICE trying insert trap
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: akrl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 50205
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50205&action=edit
reproducer

Hi all,

to reproduce with the attached:

=========
$ gcc libgccjit_repro.c -lgccjit
$ ./a.out
Segmentation fault (core dumped)
=========

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

MEM[(struct comp_Lisp_Cons *)0B].u.s.car = _35;

>From the 'F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_0'
function.

Running pass 'isolate-paths' we try to inject a trap but
'builtin_decl_explicit (BUILT_IN_TRAP)' is returning NULL as the
builtin declaration that we should find in 'builtin_info' is never
initialized by the frontend (libgccjit).  As a consequence we ICE in
'gimple_build_call'.

Here the backtrace:

#0  gimple_build_call (fn=0x0, nargs=nargs@entry=0) at ../../gcc/gimple.c:264
#1  0x00007ffff7450cf8 in insert_trap (si_p=si_p@entry=0x7fffffffde20,
op=0x7ffff5654fc0) at ../../gcc/gimple-ssa-isolate-paths.c:93
#2  0x00007ffff745302b in find_explicit_erroneous_behavior () at
../../gcc/gimple-ssa-isolate-paths.c:863
#3  gimple_ssa_isolate_erroneous_paths () at
../../gcc/gimple-ssa-isolate-paths.c:928
#4  (anonymous namespace)::pass_isolate_erroneous_paths::execute
(this=<optimized out>) at ../../gcc/gimple-ssa-isolate-paths.c:979
#5  0x00007ffff6a7fc3d in execute_one_pass (pass=0x6255a0) at
../../gcc/passes.c:2509
#6  0x00007ffff6a803a8 in execute_pass_list_1 (pass=0x6255a0) at
../../gcc/passes.c:2597
#7  0x00007ffff6a803ba in execute_pass_list_1 (pass=0x624990) at
../../gcc/passes.c:2598
#8  0x00007ffff6a80405 in execute_pass_list (fn=0x7ffff5849790, pass=<optimized
out>) at ../../gcc/passes.c:2608
#9  0x00007ffff6790428 in cgraph_node::expand (this=0x7ffff5850ca8) at
../../gcc/context.h:48
#10 0x00007ffff6791a6d in expand_all_functions () at
../../gcc/cgraphunit.c:2476
[...]

This ICE breaks Emacs bootstrap on 32bit machines configuring with
'--with-wide-int'.

A reduced reduced should be writable (manually as there's no creduce
for libgccjit) ATM I'm posting what I have from Emacs.

GCC 10 is likely to be affected too, I'll try it soon, GCC 9 is
working and does not show this bug.

  Andrea

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

end of thread, other threads:[~2024-06-25 23:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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
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

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