[Bug sanitizer/85213] New: -fsanitize=undefined internal compiler error: in fold_convert_loc, at fold-const.c:2402
vegard.nossum at oracle dot com
gcc-bugzilla@gcc.gnu.org
Wed Apr 4 20:46:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85213
Bug ID: 85213
Summary: -fsanitize=undefined internal compiler error: in
fold_convert_loc, at fold-const.c:2402
Product: gcc
Version: 8.0.1
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: vegard.nossum at oracle dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
Input (valid AFAICT):
int f(int x) {
return (__builtin_expect(({ x != 0; }) ? 0 : 1, 3) == 0) * -1 << 0;
}
Output:
$ cc1plus -O1 -fsanitize=undefined -g
int f(int)
Analyzing compilation unit
output/ice-fold_covert_loc.cc:2:27: internal compiler error: in
fold_convert_loc, at fold-const.c:2402
return (__builtin_expect(({ x != 0; }) ? 0 : 1, 3) == 0) * -1 << 0;
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
0x1fb2e1b fold_convert_loc(unsigned int, tree_node*, tree_node*)
/home/vegard/git/gcc/gcc/fold-const.c:2401
0x227d824 gimplify_cond_expr
/home/vegard/git/gcc/gcc/gimplify.c:4034
0x222a3a6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:11391
0x2236ae1 gimplify_stmt(tree_node**, gimple**)
/home/vegard/git/gcc/gcc/gimplify.c:6658
0x227cfbe gimplify_cond_expr
/home/vegard/git/gcc/gcc/gimplify.c:4022
0x222a3a6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:11391
0x225b10c gimplify_expr
/home/vegard/git/gcc/gcc/gimplify.c:12430
0x22606a8 gimplify_arg(tree_node**, gimple**, unsigned int, bool)
/home/vegard/git/gcc/gcc/gimplify.c:3176
0x2262d8b gimplify_call_expr
/home/vegard/git/gcc/gcc/gimplify.c:3382
0x222936f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:11406
0x2227a92 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:12159
0x22234a7 internal_get_tmp_var
/home/vegard/git/gcc/gcc/gimplify.c:575
0x222e2e0 get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
/home/vegard/git/gcc/gcc/gimplify.c:628
0x222e2e0 gimplify_save_expr
/home/vegard/git/gcc/gcc/gimplify.c:5931
0x222e2e0 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:11734
0x2227a92 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:12159
0x2227ac0 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:12161
0x227d943 gimplify_cond_expr
/home/vegard/git/gcc/gcc/gimplify.c:4063
0x222a3a6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/vegard/git/gcc/gcc/gimplify.c:11391
0x227c58d gimplify_stmt(tree_node**, gimple**)
/home/vegard/git/gcc/gcc/gimplify.c:6658
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.
Built from r259106.
Test case was minimised by C-Reduce.
It seems -fsanitize=shift is enough to trigger it. The shift is by 0, though,
so it should be valid (even though the shifted value is potentially negative).
7.3.0 seems to accept it just fine.
More information about the Gcc-bugs
mailing list