http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59258
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #1)
> Ugh, of course. This should fix it. Thanks for the report.
Seems to work for the reduced test case but not for the big code - also
-fsanitize=addr can only detect a segfault. Hopefully, it can be reduced to
something small. Currently, it looks as if it could be a similar kind of bug,
which makes reducing difficult.
> --- a/gcc/ubsan.c
> +++ b/gcc/ubsan.c
How about also adding:
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -468,4 +468,5 @@ ubsan_create_data (const char *name, location_t loc,
for (i = 0; i < nelts; i++)
{
+ gcc_checking_assert (i < 5);
t = (*saved_args)[i];