diff options
author | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-10 01:06:49 +0000 |
---|---|---|
committer | amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-10 01:06:49 +0000 |
commit | 916b643b70926f2afb5dbff921253a94fa0e56a1 (patch) | |
tree | ed3a68d4a1dfebd13840f02ab890d9c6cd74e803 /gcc/varasm.c | |
parent | 6345d24bd2c913fe6a8662ec219c002cdfa5f71a (diff) | |
download | gcc-916b643b70926f2afb5dbff921253a94fa0e56a1.tar.gz |
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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198762 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 2532d804214..6fb49cfa2d2 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); } @@ -5990,7 +5994,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)) @@ -6349,8 +6353,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); } |