This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello! This patch ensures that integer constant fits smaller type. "short_shift" is set when integer constant > 0 by checking the sign with tree_int_cst_sgn, and when "short_shift" is used, we re-check op1 with "compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0". For some reason, tree_int_cst_sgn and compare_tree_int don't agree on signedness of op1, leading to (kind of) invalid conversion of huge negative value from QImode to QImode. 2009-09-21 Uros Bizjak <ubizjak@gmail.com> PR c/39779 * c-typeck.c (build_binary_op) <short_shift>: Check that integer constant fits in smaller type. testsuite/ChangeLog: 2009-09-21 Uros Bizjak <ubizjak@gmail.com> PR c/39779 * gcc.c-torture/compile/pr39779.c: New test. Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. OK for mainline and release branches? Uros.
Attachment:
p.diff.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |