OSDN Git Service

PR c/39779
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Sep 2009 06:43:56 +0000 (06:43 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Sep 2009 06:43:56 +0000 (06:43 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152058 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr39779.c [new file with mode: 0644]

index eece990..4ee5b37 100644 (file)
@@ -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
        * 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
        (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.
 
 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.
 
 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.
 
        * 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>
 
index 411b9ec..1b2b858 100644 (file)
@@ -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
index efd31a7..8f51151 100644 (file)
@@ -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 (file)
index 0000000..d1680df
--- /dev/null
@@ -0,0 +1,5 @@
+int test (char v1)
+{
+  v1 >>= 0xdebecced;
+  return v1;
+}