diff options
author | Alan Modra <amodra@gmail.com> | 2013-05-10 01:54:06 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-05-10 01:54:06 +0000 |
commit | 734dceca5e2e3a7d71ace47b298d2cac6846ce80 (patch) | |
tree | 12425f4f0865bab3f7078cc213aedd2316994dbf /gcc/varasm.c | |
parent | 651a44e30c806d3ba6803052611a4441add83a7d (diff) |
PR target/55033
* varasm.c (default_elf_select_section): Move !DECL_P check..
(get_named_section): ..to here before calling get_section_name.
Adjust assertion.
(default_section_type_flags): Add DECL_P check.
* config/i386/winnt.c (i386_pe_section_type_flags): Likewise.
* config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): Likewise.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@198763 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 66481031022..ea709fd8eeb 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -402,12 +402,16 @@ get_named_section (tree decl, const char *name, int reloc) { unsigned int flags; - gcc_assert (!decl || DECL_P (decl)); if (name == NULL) - name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); + { + gcc_assert (decl && DECL_P (decl) && DECL_SECTION_NAME (decl)); + name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); + } flags = targetm.section_type_flags (decl, name, reloc); + if (decl && !DECL_P (decl)) + decl = NULL_TREE; return get_section (name, flags, decl); } @@ -5989,7 +5993,7 @@ default_section_type_flags (tree decl, const char *name, int reloc) flags |= SECTION_RELRO; } - if (decl && DECL_ONE_ONLY (decl)) + if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl)) flags |= SECTION_LINKONCE; if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl)) @@ -6348,8 +6352,6 @@ default_elf_select_section (tree decl, int reloc, gcc_unreachable (); } - if (!DECL_P (decl)) - decl = NULL_TREE; return get_named_section (decl, sname, reloc); } |