[Bug sanitizer/80349] [6 Regression] UBSAN: compile time crash with "type mismatch in binary expression" message
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 25 20:00:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80349
--- Comment #14 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I believe this all section needs fixing and new testcases:
10793 tree arg00 = TREE_OPERAND (arg0, 0);
10794 tree arg01 = TREE_OPERAND (arg0, 1);
10795 tree arg10 = TREE_OPERAND (arg1, 0);
10796 tree arg11 = TREE_OPERAND (arg1, 1);
10797 tree itype = TREE_TYPE (arg0);
10798
10799 if (operand_equal_p (arg01, arg11, 0))
10800 return fold_build2_loc (loc, code, type,
10801 fold_build2_loc (loc, BIT_AND_EXPR,
itype,
10802 fold_build2_loc (loc,
10803 BIT_XOR_EXPR,
itype,
10804 arg00, arg10),
10805 arg01),
10806 build_zero_cst (itype));
10807
10808 if (operand_equal_p (arg01, arg10, 0))
10809 return fold_build2_loc (loc, code, type,
10810 fold_build2_loc (loc, BIT_AND_EXPR,
itype,
10811 fold_build2_loc (loc,
10812 BIT_XOR_EXPR,
itype,
10813 arg00, arg11),
10814 arg01),
10815 build_zero_cst (itype));
10816
10817 if (operand_equal_p (arg00, arg11, 0))
10818 return fold_build2_loc (loc, code, type,
10819 fold_build2_loc (loc, BIT_AND_EXPR,
itype,
10820 fold_build2_loc (loc,
10821 BIT_XOR_EXPR,
itype,
10822 arg01, arg10),
10823 arg00),
10824 build_zero_cst (itype));
10825
10826 if (operand_equal_p (arg00, arg10, 0))
10827 return fold_build2_loc (loc, code, type,
10828 fold_build2_loc (loc, BIT_AND_EXPR,
itype,
10829 fold_build2_loc (loc,
10830 BIT_XOR_EXPR,
itype,
10831 arg01, arg11),
10832 arg00),
10833 build_zero_cst (itype));
More information about the Gcc-bugs
mailing list