diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-09-22 08:15:32 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-09-22 08:15:32 +0000 |
commit | 50b4b446bb3894b6b8a830554009bd9cbdb8009a (patch) | |
tree | 2f80601647400b0089de32d9372be9b6f3038dc4 /gcc/tree-ssa-structalias.c | |
parent | 6bb4c3e2d8a978c590c01df7807c4e0819b33b85 (diff) | |
download | gcc-50b4b446bb3894b6b8a830554009bd9cbdb8009a.zip gcc-50b4b446bb3894b6b8a830554009bd9cbdb8009a.tar.gz gcc-50b4b446bb3894b6b8a830554009bd9cbdb8009a.tar.bz2 |
Handle single restrict pointer in struct in create_variable_info_for_1
2015-09-22 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/67666
* tree-ssa-structalias.c (create_variable_info_for_1): Handle struct
with single field non-conservative.
* g++.dg/pr67666.C: New test.
From-SVN: r227996
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index cf2b2f4..66772cd 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5675,7 +5675,7 @@ create_variable_info_for_1 (tree decl, const char *name) /* If we didn't end up collecting sub-variables create a full variable for the decl. */ - if (fieldstack.length () <= 1 + if (fieldstack.length () == 0 || fieldstack.length () > MAX_FIELDS_FOR_FIELD_SENSITIVE) { vi = new_var_info (decl, name); @@ -5694,19 +5694,26 @@ create_variable_info_for_1 (tree decl, const char *name) fieldstack.iterate (i, &fo); ++i, newvi = vi_next (newvi)) { - const char *newname = "NULL"; + const char *newname = NULL; char *tempname; if (dump_file) { - tempname - = xasprintf ("%s." HOST_WIDE_INT_PRINT_DEC - "+" HOST_WIDE_INT_PRINT_DEC, name, - fo->offset, fo->size); - newname = ggc_strdup (tempname); - free (tempname); + if (fieldstack.length () != 1) + { + tempname + = xasprintf ("%s." HOST_WIDE_INT_PRINT_DEC + "+" HOST_WIDE_INT_PRINT_DEC, name, + fo->offset, fo->size); + newname = ggc_strdup (tempname); + free (tempname); + } } - newvi->name = newname; + else + newname = "NULL"; + + if (newname) + newvi->name = newname; newvi->offset = fo->offset; newvi->size = fo->size; newvi->fullsize = vi->fullsize; |