diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2009-09-23 08:43:56 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2009-09-23 08:43:56 +0200 |
commit | be12343976ff4b516eb80c983d9ad613ff9a2593 (patch) | |
tree | 15e99879c42bf7c05a952c82b854878e4a17c80d | |
parent | d57c0139831d98f97ee0ea892b5cf4e728ecf508 (diff) | |
download | gcc-be12343976ff4b516eb80c983d9ad613ff9a2593.zip gcc-be12343976ff4b516eb80c983d9ad613ff9a2593.tar.gz gcc-be12343976ff4b516eb80c983d9ad613ff9a2593.tar.bz2 |
re PR c/39779 (ICE shifting byte to the right with constant > 7FFFFFFF)
PR c/39779
* c-typeck.c (build_binary_op) <short_shift>: Check that integer
constant is more than zero.
testsuite/ChangeLog:
PR c/39779
* gcc.c-torture/compile/pr39779.c: New test.
From-SVN: r152058
-rw-r--r-- | gcc/ChangeLog | 27 | ||||
-rw-r--r-- | gcc/c-typeck.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr39779.c | 5 |
4 files changed, 28 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eece990..4ee5b37 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-09-23 Uros Bizjak <ubizjak@gmail.com> + + PR c/39779 + * c-typeck.c (build_binary_op) <short_shift>: Check that integer + constant is more than zero. + 2009-09-23 Alan Modra <amodra@bigpond.net.au> PR target/40473 @@ -10,13 +16,13 @@ * doc/install.texi (*-*-freebsd*): Add proper format codes. 2009-09-22 Basile Starynkevitch <basile@starynkevitch.net> - Rafael Avila de Espindola <espindola@google.com> + Rafael Avila de Espindola <espindola@google.com> * gengtype.c (is_file_equal): New function. (close_output_files): Use is_file_equal. Free of->buf. 2009-09-22 Basile Starynkevitch <basile@starynkevitch.net> - Rafael Avila de Espindola <espindola@google.com> + Rafael Avila de Espindola <espindola@google.com> * gengtype.c (write_types, write_local): Add the output_header argument. Update all callers. @@ -33,8 +39,8 @@ represented by usual DW_TAG_template_*_parameter DIEs that are children of the DW_TAG_template_parameter_pack element DIE. (generic_parameter_die): This doesn't deal with parameter pack - names anymore. Don't generate DW_AT_name for some DIEs, e.g. children of - parameter pack DIEs. + names anymore. Don't generate DW_AT_name for some DIEs, e.g. children + of parameter pack DIEs. (gen_formal_parameter_die): Add a flag to not emit DW_AT_name in certain cases, e.g. for pack elements. (gen_formal_types_die, gen_decl_die): Adjust usage of @@ -170,7 +176,8 @@ (INITIALIZE_TRAMPOLINE): Move code to arm_trampoline_init; adjust for target hook parameters. - * config/avr/avr.h (TRAMPOLINE_TEMPLATE, INITIALIZE_TRAMPOLINE): Remove. + * config/avr/avr.h (TRAMPOLINE_TEMPLATE, INITIALIZE_TRAMPOLINE): + Remove. * config/bfin/bfin-protos.h (initialize_trampoline): Remove. * config/bfin/bfin.c (bfin_asm_trampoline_template): New. @@ -520,8 +527,8 @@ 2009-09-21 Giuseppe Scrivano <gscrivano@gnu.org> - * tree-tailcall.c (process_assignment): Don't check if a multiplication - or an addition are already present. + * tree-tailcall.c (process_assignment): Don't check if a + multiplication or an addition are already present. (find_tail_calls): Combine multiple additions and multiplications. (adjust_accumulator_values): Emit accumulators. @@ -557,7 +564,8 @@ 2009-09-20 Jan Hubicka <jh@suse.cz> * dwarf2out.c (add_const_value_attribute): Return true if successful. - (add_location_or_const_value_attribute): Rewrite using loc_list_from_tree. + (add_location_or_const_value_attribute): Rewrite using + loc_list_from_tree. (tree_add_const_value_attribute): Return true if successful. (tree_add_const_value_attribute_for_decl): Likewise. @@ -655,8 +663,7 @@ * configure: Regenerate. * doc/invoke.texi (Option Summary): Add -mrelax-pic-calls and -mno-relax-pic-calls. - (MIPS Options): Document -mrelax-pic-calls - and -mno-relax-pic-calls. + (MIPS Options): Document -mrelax-pic-calls and -mno-relax-pic-calls. 2009-09-19 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 411b9ec..1b2b858 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -9465,6 +9465,7 @@ build_binary_op (location_t location, enum tree_code code, unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0)); if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type) + && tree_int_cst_sgn (op1) > 0 /* We can shorten only if the shift count is less than the number of bits in the smaller type size. */ && compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index efd31a7..8f51151 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-09-23 Uros Bizjak <ubizjak@gmail.com> + + PR c/39779 + * gcc.c-torture/compile/pr39779.c: New test. + 2009-09-22 Dodji Seketeli <dodji@redhat.com> * g++.dg/debug/dwarf2/template-func-params-4.C: Adjust. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39779.c b/gcc/testsuite/gcc.c-torture/compile/pr39779.c new file mode 100644 index 0000000..d1680df --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr39779.c @@ -0,0 +1,5 @@ +int test (char v1) +{ + v1 >>= 0xdebecced; + return v1; +} |