This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid SRA-created debug binds with uninitialized RHSs
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 27 Feb 2013 16:08:09 +0100
- Subject: [PATCH] Avoid SRA-created debug binds with uninitialized RHSs
Hi,
looking at dumps of PR 56294 I have noticed that on one occasion, SRA
total scalarization mechanism replaced an uninitialized structure with
scalar replacements and these then happened to end up in DEBUG bind
statements describing another structure. Such replacements then did
not end up in the IL anywhere else (and not at all in -g0). SSA
renaming is clever enough to replace them with NULLs later on but if
the replacements are never initialized in the function, this can be
easily avoided.
Bootstrapped and tested on x86_64-linux without any issues. So far I
do not know whether it is required to fix PR 56294 but the patch is
tiny and simply avoids unnecessary work so I'd like to ask for
approval to commit to trunk now.
Thanks,
Martin
2013-02-26 Martin Jambor <mjambor@suse.cz>
* tree-sra.c (load_assign_lhs_subreplacements): Do not put replacements
with no initialization to the RHS of debug statements.
Index: src/gcc/tree-sra.c
===================================================================
--- src.orig/gcc/tree-sra.c
+++ src/gcc/tree-sra.c
@@ -2870,7 +2870,12 @@ load_assign_lhs_subreplacements (struct
lacc->size);
if (racc && racc->grp_to_be_replaced)
- drhs = get_access_replacement (racc);
+ {
+ if (racc->grp_write)
+ drhs = get_access_replacement (racc);
+ else
+ drhs = NULL;
+ }
else if (*refreshed == SRA_UDH_LEFT)
drhs = build_debug_ref_for_model (loc, lacc->base, lacc->offset,
lacc);