This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix one issue reported by valgrind (PR other/58712)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 15 Jan 2014 09:14:24 +0100
- Subject: [committed] Fix one issue reported by valgrind (PR other/58712)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
When memcpy has constant length, we leave probable_max_size uninitialized
and later on create a CONST_INT out of it.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk as obvious.
2014-01-15 Jakub Jelinek <jakub@redhat.com>
PR other/58712
* builtins.c (determine_block_size): Initialize *probable_max_size
even if len_rtx is CONST_INT.
--- gcc/builtins.c.jj 2014-01-13 13:26:37.000000000 +0100
+++ gcc/builtins.c 2014-01-13 18:21:13.299612871 +0100
@@ -3117,7 +3117,7 @@ determine_block_size (tree len, rtx len_
{
if (CONST_INT_P (len_rtx))
{
- *min_size = *max_size = UINTVAL (len_rtx);
+ *min_size = *max_size = *probable_max_size = UINTVAL (len_rtx);
return;
}
else
@@ -3131,7 +3131,8 @@ determine_block_size (tree len, rtx len_
else
*min_size = 0;
if (tree_fits_uhwi_p (TYPE_MAX_VALUE (TREE_TYPE (len))))
- *probable_max_size = *max_size = tree_to_uhwi (TYPE_MAX_VALUE (TREE_TYPE (len)));
+ *probable_max_size = *max_size
+ = tree_to_uhwi (TYPE_MAX_VALUE (TREE_TYPE (len)));
else
*probable_max_size = *max_size = GET_MODE_MASK (GET_MODE (len_rtx));
Jakub