aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-06-11 20:43:59 +0930
committerAlan Modra <amodra@gcc.gnu.org>2013-06-11 20:43:59 +0930
commit2c7b8bf6d3e875772946d9c4dd10ecb6a8a8b883 (patch)
tree4aace318bebf16cf709ecf3a3db77e883e760ccd /gcc
parent0372af98bd3e02f578f1ad0c097e3619e28c64e4 (diff)
downloadgcc-2c7b8bf6d3e875772946d9c4dd10ecb6a8a8b883.zip
gcc-2c7b8bf6d3e875772946d9c4dd10ecb6a8a8b883.tar.gz
gcc-2c7b8bf6d3e875772946d9c4dd10ecb6a8a8b883.tar.bz2
varasm.c (get_section): Don't die on !DECL_P decl.
* varasm.c (get_section): Don't die on !DECL_P decl. Tidy error reporting. (get_named_section): Don't NULL !DECL_P decl. From-SVN: r199949
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/varasm.c28
2 files changed, 20 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 52f7e7c..f346780 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-06-11 Alan Modra <amodra@gmail.com>
+
+ * varasm.c (get_section): Don't die on !DECL_P decl. Tidy error
+ reporting.
+ (get_named_section): Don't NULL !DECL_P decl.
+
2013-06-11 Igor Zamyatin <igor.zamyatin@intel.com>
* doc/invoke.texi (core-avx2): Document.
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 5639531..d2b9415 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -307,19 +307,22 @@ get_section (const char *name, unsigned int flags, tree decl)
return sect;
}
/* Sanity check user variables for flag changes. */
- if (decl == 0)
- decl = sect->named.decl;
- gcc_assert (decl);
- if (sect->named.decl == NULL)
- error ("%+D causes a section type conflict", decl);
- else
+ if (sect->named.decl != NULL
+ && DECL_P (sect->named.decl)
+ && decl != sect->named.decl)
{
- error ("%+D causes a section type conflict with %D",
- decl, sect->named.decl);
- if (decl != sect->named.decl)
- inform (DECL_SOURCE_LOCATION (sect->named.decl),
- "%qD was declared here", sect->named.decl);
+ if (decl != NULL && DECL_P (decl))
+ error ("%+D causes a section type conflict with %D",
+ decl, sect->named.decl);
+ else
+ error ("section type conflict with %D", sect->named.decl);
+ inform (DECL_SOURCE_LOCATION (sect->named.decl),
+ "%qD was declared here", sect->named.decl);
}
+ else if (decl != NULL && DECL_P (decl))
+ error ("%+D causes a section type conflict", decl);
+ else
+ error ("section type conflict");
/* Make sure we don't error about one section multiple times. */
sect->common.flags |= SECTION_OVERRIDE;
}
@@ -409,9 +412,6 @@ get_named_section (tree decl, const char *name, int reloc)
}
flags = targetm.section_type_flags (decl, name, reloc);
-
- if (decl && !DECL_P (decl))
- decl = NULL_TREE;
return get_section (name, flags, decl);
}