Created attachment 45722 [details] Preprocessed code of file named "sam.c" which caused internal compiler error -----------------------COMMAND USED FOR COMPILATION--------------------------- ~/gcc-9-trunk/build/gcc/xgcc -B ~/gcc-9-trunk/build/gcc/ sam.c -fgnu-tm -w -Icsmith-crash-test/csmith/runtime/ during RTL pass: expand sam.c: In function ‘func_33’: sam.c:857:139: internal compiler error: in exact_div, at poly-int.h:2139 857 | != l_130) , ((g_133[0][1] , l_134) != (p_36 != (void*)0))) > g_100.f3)) & ((void*)0 == l_135)) || 0xAC466B2A51B1567ELL) > g_56.f0); | ~~~~~^~~ 0x92f6f8 poly_int<1u, poly_result<long, if_nonpoly<int, int, poly_int_traits<int>::is_poly>::type, poly_coeff_pair_traits<long, if_nonpoly<int, int, poly_int_traits<int>::is_poly>::type>::result_kind>::type> exact_div<1u, long, int>(poly_int_pod<1u, long> const&, int) ../../gcc/gcc/poly-int.h:2139 0x92f6f8 expand_expr_addr_expr_1 ../../gcc/gcc/expr.c:8041 0x9220ed expand_expr_addr_expr ../../gcc/gcc/expr.c:8082 0x9220ed expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/gcc/expr.c:11237 0x7dfb37 expand_normal ../../gcc/gcc/expr.h:285 0x7dfb37 precompute_register_parameters ../../gcc/gcc/calls.c:967 0x7dfb37 expand_call(tree_node*, rtx_def*, int) ../../gcc/gcc/calls.c:3998 0x7ccc0d expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int) ../../gcc/gcc/builtins.c:8337 0x921918 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc/gcc/expr.c:11005 0x92fb14 store_expr(tree_node*, rtx_def*, int, bool, bool) ../../gcc/gcc/expr.c:5649 0x93194e expand_assignment(tree_node*, tree_node*, bool) ../../gcc/gcc/expr.c:5432 0x7f4076 expand_call_stmt ../../gcc/gcc/cfgexpand.c:2722 0x7f4076 expand_gimple_stmt_1 ../../gcc/gcc/cfgexpand.c:3691 0x7f4076 expand_gimple_stmt ../../gcc/gcc/cfgexpand.c:3850 0x7f6ef5 expand_gimple_basic_block ../../gcc/gcc/cfgexpand.c:5886 0x7fd1e6 execute ../../gcc/gcc/cfgexpand.c:6509 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. -----------------------REDUCED TEST CASE------------------------------------- struct { signed : 5; unsigned b : 7 } c[][1]; a() {} d() { __transaction_relaxed { a(c[0][1].b); } } ----------------------COMPILER BUILD OPTIONS--------------------------------- Using built-in specs. COLLECT_GCC=build/gcc/xgcc Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=c,c++ --enable-lto --disable-bootstrap : (reconfigured) ../gcc/configure --enable-languages=c,c++ --enable-lto --disable-bootstrap Thread model: posix gcc version 9.0.1 20190214 (experimental) (GCC)
Cleaned up testcase with -fgnu-tm: struct S { int a : 5; unsigned b : 7; } c[1][1]; void foo (int x) { } void bar (void) { __transaction_relaxed { foo (c[0][1].b); } } Seems the TM code can't deal with bitfields properly: _15 = __builtin__ITM_RU1 (&c[0][1].b); taking address of a bitfield is invalid. Dunno what exactly it should do, perhaps tak address of the DECL_BIT_FIELD_REPRESENTATIVE and read the DECL_BIT_FIELD_REPRESENTATIVE instead and then BIT_FIELD_REF or something similar out of this? And similarly deal somehow with the stores to bitfields (that is actually a read modify write cycle that likely would need to be exposed. That said, -fgnu-tm is pretty much unmaintained for years, so maybe best would be to remove that support (e.g. I believe it doesn't handle internal functions at all, which appear commonly in the IL these days, doesn't handle various builtins correctly, etc.).
IIRC seeing dups with bitfield handling of TM.
Dup of bug 87118. *** This bug has been marked as a duplicate of bug 87118 ***