* PR78629
@ 2016-12-01 13:27 Prathamesh Kulkarni
2016-12-01 13:28 ` PR78629 Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Prathamesh Kulkarni @ 2016-12-01 13:27 UTC (permalink / raw)
To: gcc Patches, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
Hi Richard,
I tested your fix for the patch with ubsan stage-1 built gcc, and it
fixes the error.
Is it OK to commit if bootstrap+test passes on x86_64-unknown-linux-gnu ?
Thanks,
Prathamesh
[-- Attachment #2: pr78629-1.txt --]
[-- Type: text/plain, Size: 1058 bytes --]
2016-12-01 Richard Biener <rguenther@suse.de>
Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
PR middle-end/78629
* vec.h (vec<T, A, vl_embed>::quick_grow_cleared): Guard call to
memset if len-oldlen != 0.
(vec<T, va_heap, vl_ptr>::safe_grow_cleared): Likewise.
diff --git a/gcc/vec.h b/gcc/vec.h
index 14fb2a6..aa93411 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1092,8 +1092,10 @@ inline void
vec<T, A, vl_embed>::quick_grow_cleared (unsigned len)
{
unsigned oldlen = length ();
+ size_t sz = sizeof (T) * (len - oldlen);
quick_grow (len);
- memset (&(address ()[oldlen]), 0, sizeof (T) * (len - oldlen));
+ if (sz != 0)
+ memset (&(address ()[oldlen]), 0, sz);
}
@@ -1605,8 +1607,10 @@ inline void
vec<T, va_heap, vl_ptr>::safe_grow_cleared (unsigned len MEM_STAT_DECL)
{
unsigned oldlen = length ();
+ size_t sz = sizeof (T) * (len - oldlen);
safe_grow (len PASS_MEM_STAT);
- memset (&(address ()[oldlen]), 0, sizeof (T) * (len - oldlen));
+ if (sz != 0)
+ memset (&(address ()[oldlen]), 0, sz);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PR78629
2016-12-01 13:27 PR78629 Prathamesh Kulkarni
@ 2016-12-01 13:28 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-12-01 13:28 UTC (permalink / raw)
To: Prathamesh Kulkarni; +Cc: gcc Patches
On Thu, 1 Dec 2016, Prathamesh Kulkarni wrote:
> Hi Richard,
> I tested your fix for the patch with ubsan stage-1 built gcc, and it
> fixes the error.
> Is it OK to commit if bootstrap+test passes on x86_64-unknown-linux-gnu ?
Ok.
Richard.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-01 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01 13:27 PR78629 Prathamesh Kulkarni
2016-12-01 13:28 ` PR78629 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).