https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69257
Bug ID: 69257 Summary: g++ ICE (segfault) on x86_64-linux-gnu in "create_tmp_var" Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- The following code causes an ICE when compiled with the current g++ trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. It also crashes 4.4, 4.6 and 4.8. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 6.0.0 20160112 (experimental) [trunk revision 232269] (GCC) $ g++-4.4 -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.7-8ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --disable-libmudflap --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.4.7 (Ubuntu/Linaro 4.4.7-8ubuntu1) $ g++-4.4 -c abc.cc abc.cc: In function ‘int fn1()’: abc.cc:3: internal compiler error: in create_tmp_var, at gimplify.c:556 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions. $ g++-trunk -c abc.cc abc.cc: In function ‘int fn1()’: abc.cc:3:20: internal compiler error: in create_tmp_var, at gimple-expr.c:473 __asm ( "": :"" (*x)); ^~ 0xa9d883 create_tmp_var(tree_node*, char const*) ../../gcc/gcc/gimple-expr.c:473 0xaccd2e create_tmp_from_val ../../gcc/gcc/gimplify.c:498 0xaccd2e lookup_tmp_var ../../gcc/gcc/gimplify.c:519 0xaccd2e internal_get_tmp_var ../../gcc/gcc/gimplify.c:563 0xac49f6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:11035 0xadabd4 gimplify_asm_expr ../../gcc/gcc/gimplify.c:5320 0xac6679 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10434 0xac9f06 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5616 0xac52ff gimplify_cleanup_point_expr ../../gcc/gcc/gimplify.c:5392 0xac52ff gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10479 0xac9f06 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5616 0xac62fb gimplify_statement_list ../../gcc/gcc/gimplify.c:1526 0xac62fb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10531 0xac9f06 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5616 0xacb12d gimplify_bind_expr ../../gcc/gcc/gimplify.c:1142 0xac5252 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:10313 0xac9f06 gimplify_stmt(tree_node**, gimple**) ../../gcc/gcc/gimplify.c:5616 0xacbdb5 gimplify_body(tree_node*, bool) ../../gcc/gcc/gimplify.c:11245 0xacc3e6 gimplify_function_tree(tree_node*) ../../gcc/gcc/gimplify.c:11401 0x953da7 cgraph_node::analyze() ../../gcc/gcc/cgraphunit.c:625 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. ----- $ cat abc.cc int fn1() { struct S *x; __asm ( "": :"" (*x)); }