https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW Component|c |middle-end Known to work| |4.8.4, 4.9.2 Summary|internal compiler error: |[5/6 Regression] internal |Segmentation fault -- |compiler error: |raidctl.c 'do_meter' |Segmentation fault Known to fail| |5.0, 6.0 --- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- markus@x4 tmp % cat raidctl.i extern int snprintf(char *, unsigned long, const char *, ...); const char a[] = ""; int b; void get_bar () { snprintf (0, 0, "%s", &a[b]); } markus@x4 tmp % gcc -c -O2 raidctl.i raidctl.i: In function ‘get_bar’: raidctl.i:5:1: internal compiler error: tree check: expected integer_cst, have negate_expr in decompose, at tree.h:4929 get_bar () { snprintf (0, 0, "%s", &a[b]); } ^ 0xd3447c tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9352 0x58db55 tree_check(tree_node const*, char const*, int, char const*, tree_code) ../../gcc/gcc/tree.h:3113 0x58db55 wi::int_traits<tree_node const*>::decompose(long*, unsigned int, tree_node const*) ../../gcc/gcc/tree.h:4929 0xd39d2a wi::int_traits<tree_node const*>::decompose(long*, unsigned int, tree_node const*) ../../gcc/gcc/tree.h:3060 0xd39d2a wide_int_ref_storage<false>::wide_int_ref_storage<tree_node const*>(tree_node const* const&, unsigned int) ../../gcc/gcc/wide-int.h:957 0xd39d2a generic_wide_int<wide_int_ref_storage<false> >::generic_wide_int<tree_node const*>(tree_node const* const&, unsigned int) ../../gcc/gcc/wide-int.h:733 0xd39d2a bool wi::eq_p<tree_node const*, int>(tree_node const* const&, int const&) ../../gcc/gcc/wide-int.h:1715 0xd39d2a tree_int_cst_sgn(tree_node const*) ../../gcc/gcc/tree.c:7239 0xd3a95e compare_tree_int(tree_node const*, unsigned long) ../../gcc/gcc/tree.c:7448 0x85e27c gimple_fold_builtin_snprintf ../../gcc/gcc/gimple-fold.c:2543 0x85e27c gimple_fold_builtin ../../gcc/gcc/gimple-fold.c:2954 0x8604b0 gimple_fold_call ../../gcc/gcc/gimple-fold.c:3182 0x8604b0 fold_stmt_1 ../../gcc/gcc/gimple-fold.c:3677 0xbf86b7 execute ../../gcc/gcc/tree-ssa-forwprop.c:2350 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.