https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95730
Bug ID: 95730 Summary: GCN offloading ICEs after commit fe7ebef7fe4f9acb79658ed9db0749b07efc3105 "Add support for __builtin_bswap128" Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: openacc, openmp Severity: normal Priority: P3 Component: target Assignee: ams at gcc dot gnu.org Reporter: tschwinge at gcc dot gnu.org CC: ebotcazou at gcc dot gnu.org, jules at gcc dot gnu.org Target Milestone: --- Target: gcn For a few libgomp test cases, the recent commit fe7ebef7fe4f9acb79658ed9db0749b07efc3105 "Add support for __builtin_bswap128" is causing ICE regressions with GCN offloading (only, apparently: not seen for Intel MIC (emulated), or nvptx offloading): 'libgomp.fortran/pr90779.f90': lto1: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in lto_input_tree_1, at lto-streamer-in.c:1561 #0 internal_error (gmsgid=0x163f958 "tree check: expected class %qs, have %qs (%s) in %s, at %s:%d") at [...]/source-gcc/gcc/diagnostic.c:1706 #1 0x000000000055f2fd in tree_class_check_failed (node=0x7ffff67b4960, cl=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at [...]/source-gcc/gcc/tree.c:9738 #2 0x00000000009d7886 in tree_class_check (__g=<optimized out>, __l=1561, __f=0x15d1208 "[...]/source-gcc/gcc/lto-streamer-in.c", __class=tcc_type, __t=0x7ffff67b4960) at [...]/source-gcc/gcc/tree.h:3424 #3 lto_input_tree_1 (ib=0x7fffffffd080, data_in=0x1dd4860, tag=<optimized out>, hash=<optimized out>) at [...]/source-gcc/gcc/lto-streamer-in.c:1561 #4 0x00000000005d84b6 in lto_read_decls (resolutions=..., data=0x1e3a630, decl_data=0x7ffff7fee090) at [...]/source-gcc/gcc/lto/lto-common.c:1955 #5 lto_file_finalize (file=0x1d8c900, order=0, file_data=0x7ffff7fee090) at [...]/source-gcc/gcc/lto/lto-common.c:2267 #6 lto_create_files_from_ids (order=0, count=<synthetic pointer>, file_data=0x7ffff7fee090, file=0x1d8c900) at [...]/source-gcc/gcc/lto/lto-common.c:2277 #7 lto_file_read (count=<synthetic pointer>, resolution_file=<optimized out>, file=<optimized out>) at [...]/source-gcc/gcc/lto/lto-common.c:2332 #8 read_cgraph_and_symbols (nfiles=<optimized out>, fnames=<optimized out>) at [...]/source-gcc/gcc/lto/lto-common.c:2784 #9 0x00000000005b9c23 in lto_main () at [...]/source-gcc/gcc/lto/lto.c:625 #10 0x0000000000b7f6ff in compile_file () at [...]/source-gcc/gcc/toplev.c:458 #11 0x000000000059302c in do_compile () at [...]/source-gcc/gcc/toplev.c:2307 #12 toplev::main (this=this@entry=0x7fffffffd240, argc=argc@entry=19, argv=0x1d766e0, argv@entry=0x7fffffffd348) at [...]/source-gcc/gcc/toplev.c:2446 #13 0x0000000000595ac7 in main (argc=19, argv=0x7fffffffd348) at [...]/source-gcc/gcc/main.c:39 (gdb) frame 3 #3 lto_input_tree_1 (ib=0x7fffffffd080, data_in=0x1dd4860, tag=<optimized out>, hash=<optimized out>) at [...]/source-gcc/gcc/lto-streamer-in.c:1561 1561 gcc_assert (TYPE_PRECISION (type) <= MAX_BITSIZE_MODE_ANY_INT); (gdb) print type $1 = (tree) 0x7ffff67b4960 (gdb) call debug_tree(type) <error_mark 0x7ffff67b4960> 'libgomp.oacc-c-c++-common/firstprivate-mappings-1.c': lto1: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in lto_fixup_prevailing_type, at lto/lto-common.c:993 #0 internal_error (gmsgid=0x163f958 "tree check: expected class %qs, have %qs (%s) in %s, at %s:%d") at [...]/source-gcc/gcc/diagnostic.c:1706 #1 0x000000000055f2fd in tree_class_check_failed (node=0x7ffff67b4960, cl=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at [...]/source-gcc/gcc/tree.c:9738 #2 0x00000000005d7724 in tree_class_check (__g=<optimized out>, __l=993, __f=0x1559cc8 "[...]/source-gcc/gcc/lto/lto-common.c", __class=tcc_type, __t=<optimized out>) at [...]/source-gcc/gcc/tree.h:3424 #3 lto_fixup_prevailing_type (t=0x7ffff6883b28) at [...]/source-gcc/gcc/lto/lto-common.c:993 #4 process_new_tree (t=t@entry=0x7ffff6883b28, hm=hm@entry=0x7fffffffd0b0, index=index@entry=467, total=total@entry=0x7fffffffd048, data_in=data_in@entry=0x1e37560) at [...]/source-gcc/gcc/lto/lto-common.c:1817 #5 0x00000000005d8e24 in lto_read_decls (resolutions=..., data=0x1e44f50, decl_data=0x7ffff7fee090) at [...]/source-gcc/gcc/lto/lto-common.c:1938 #6 lto_file_finalize (file=0x1d8bc30, order=0, file_data=0x7ffff7fee090) at [...]/source-gcc/gcc/lto/lto-common.c:2267 #7 lto_create_files_from_ids (order=0, count=<synthetic pointer>, file_data=0x7ffff7fee090, file=0x1d8bc30) at [...]/source-gcc/gcc/lto/lto-common.c:2277 #8 lto_file_read (count=<synthetic pointer>, resolution_file=<optimized out>, file=<optimized out>) at [...]/source-gcc/gcc/lto/lto-common.c:2332 #9 read_cgraph_and_symbols (nfiles=<optimized out>, fnames=<optimized out>) at [...]/source-gcc/gcc/lto/lto-common.c:2784 #10 0x00000000005b9c23 in lto_main () at [...]/source-gcc/gcc/lto/lto.c:625 #11 0x0000000000b7f6ff in compile_file () at [...]/source-gcc/gcc/toplev.c:458 #12 0x000000000059302c in do_compile () at [...]/source-gcc/gcc/toplev.c:2307 #13 toplev::main (this=this@entry=0x7fffffffd250, argc=argc@entry=18, argv=0x1d76a30, argv@entry=0x7fffffffd358) at [...]/source-gcc/gcc/toplev.c:2446 #14 0x0000000000595ac7 in main (argc=18, argv=0x7fffffffd358) at [...]/source-gcc/gcc/main.c:39 (gdb) frame 3 #3 lto_fixup_prevailing_type (t=0x7ffff6883b28) at [...]/source-gcc/gcc/lto/lto-common.c:993 993 TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t)); (gdb) call debug_tree(t) <pointer_type 0x7ffff6883b28 type <error_mark 0x7ffff67b4960> unsigned DI size <integer_cst 0x7ffff67b4978 type <integer_type 0x7ffff67b50a8 bitsizetype> constant 64> unit-size <integer_cst 0x7ffff67b4990 type <integer_type 0x7ffff67b5000 sizetype> constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality> 'libgomp.oacc-c++/firstprivate-mappings-1.C': lto1: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in lto_fixup_prevailing_type, at lto/lto-common.c:993 #0 internal_error (gmsgid=0x163f958 "tree check: expected class %qs, have %qs (%s) in %s, at %s:%d") at [...]/source-gcc/gcc/diagnostic.c:1706 #1 0x000000000055f2fd in tree_class_check_failed (node=0x7ffff67b4960, cl=<optimized out>, file=<optimized out>, line=<optimized out>, function=<optimized out>) at [...]/source-gcc/gcc/tree.c:9738 #2 0x00000000005d7849 in tree_class_check (__g=<optimized out>, __l=999, __f=0x1559cc8 "[...]/source-gcc/gcc/lto/lto-common.c", __class=tcc_type, __t=<optimized out>) at [...]/source-gcc/gcc/tree.h:3424 #3 lto_fixup_prevailing_type (t=0x7ffff687fbd0) at [...]/source-gcc/gcc/lto/lto-common.c:999 #4 process_new_tree (t=t@entry=0x7ffff687fbd0, hm=hm@entry=0x7fffffffd0b0, index=index@entry=293, total=total@entry=0x7fffffffd048, data_in=data_in@entry=0x1e37560) at [...]/source-gcc/gcc/lto/lto-common.c:1817 #5 0x00000000005d8e24 in lto_read_decls (resolutions=..., data=0x1e44f50, decl_data=0x7ffff7fee090) at [...]/source-gcc/gcc/lto/lto-common.c:1938 #6 lto_file_finalize (file=0x1d8bc30, order=0, file_data=0x7ffff7fee090) at [...]/source-gcc/gcc/lto/lto-common.c:2267 #7 lto_create_files_from_ids (order=0, count=<synthetic pointer>, file_data=0x7ffff7fee090, file=0x1d8bc30) at [...]/source-gcc/gcc/lto/lto-common.c:2277 #8 lto_file_read (count=<synthetic pointer>, resolution_file=<optimized out>, file=<optimized out>) at [...]/source-gcc/gcc/lto/lto-common.c:2332 #9 read_cgraph_and_symbols (nfiles=<optimized out>, fnames=<optimized out>) at [...]/source-gcc/gcc/lto/lto-common.c:2784 #10 0x00000000005b9c23 in lto_main () at [...]/source-gcc/gcc/lto/lto.c:625 #11 0x0000000000b7f6ff in compile_file () at [...]/source-gcc/gcc/toplev.c:458 #12 0x000000000059302c in do_compile () at [...]/source-gcc/gcc/toplev.c:2307 #13 toplev::main (this=this@entry=0x7fffffffd250, argc=argc@entry=18, argv=0x1d76a30, argv@entry=0x7fffffffd358) at [...]/source-gcc/gcc/toplev.c:2446 #14 0x0000000000595ac7 in main (argc=18, argv=0x7fffffffd358) at [...]/source-gcc/gcc/main.c:39 (gdb) frame 3 #3 lto_fixup_prevailing_type (t=0x7ffff687fbd0) at [...]/source-gcc/gcc/lto/lto-common.c:999 999 TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t)); (gdb) call debug_tree(t) <reference_type 0x7ffff687fbd0 type <error_mark 0x7ffff67b4960> unsigned DI size <integer_cst 0x7ffff67b4978 type <integer_type 0x7ffff67b50a8 bitsizetype> constant 64> unit-size <integer_cst 0x7ffff67b4990 type <integer_type 0x7ffff67b5000 sizetype> constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality> This is with '--enable-checking=yes,extra,rtl'. I have not assessed whether there are other code paths that may fail in similar ways. Note that commit fe7ebef7fe4f9acb79658ed9db0749b07efc3105 "Add support for __builtin_bswap128" didn't actually touch the LTO streaming code. From a very quick look, I cannot tell why/where gcn vs. nvptx back ends would be different in 128-bit data type handling, which I presume is where this stray 'error_mark' is coming from, indirectly. Testing current commit 1b76341441da344a0738edffdfab5d6307311ff2, I'm confirming that reverting commit fe7ebef7fe4f9acb79658ed9db0749b07efc3105 "Add support for __builtin_bswap128", and as a pre-requisite commit 0bd4508f86889995f6864bf50773bd6859951007 "Fix bits/bytes confusion in latest change to expand_unop" gets us rid of the ICE regressions.