aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2015-06-02 16:42:27 +0000
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>2015-06-02 16:42:27 +0000
commitc2d474827dbd15616799ea703ea39659d7222dce (patch)
tree867e9b53f899e2be842a020973ebfb68ddb838ef /gcc
parent4526c3c15c72115a295ed060b78b55f61f422aee (diff)
downloadgcc-c2d474827dbd15616799ea703ea39659d7222dce.zip
gcc-c2d474827dbd15616799ea703ea39659d7222dce.tar.gz
gcc-c2d474827dbd15616799ea703ea39659d7222dce.tar.bz2
re PR target/49551 (tentative declaration after definition and -fdata-sections cause ICE in C front-end.)
2015-06-02 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR c/49551 * c-decl.c (merge_decls): Merge DECL_COMMON. * gcc.dg/pr49551.c: New test-case. From-SVN: r224033
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-decl.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr49551.c7
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index bcad7b7..20122e6 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-02 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR c/49551
+ * c-decl.c (merge_decls): Merge DECL_COMMON.
+
2015-05-22 Jim Wilson <jim.wilson@linaro.org>
* Make-lang.in (check_gcc_pallelize): Define.
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index a2edefc..68c79df 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -2631,6 +2631,12 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
else if (DECL_PRESERVE_P (newdecl))
DECL_PRESERVE_P (olddecl) = 1;
+ /* Merge DECL_COMMON */
+ if (VAR_P (olddecl) && VAR_P (newdecl)
+ && !lookup_attribute ("common", DECL_ATTRIBUTES (newdecl))
+ && !lookup_attribute ("nocommon", DECL_ATTRIBUTES (newdecl)))
+ DECL_COMMON (newdecl) = DECL_COMMON (newdecl) && DECL_COMMON (olddecl);
+
/* Copy most of the decl-specific fields of NEWDECL into OLDDECL.
But preserve OLDDECL's DECL_UID, DECL_CONTEXT and
DECL_ARGUMENTS (if appropriate). */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4dd3014..5060c53 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-02 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
+
+ PR c/49551
+ * gcc.dg/pr49551.c: New testcase.
+
2015-06-02 Richard Biener <rguenther@suse.de>
PR debug/65549
diff --git a/gcc/testsuite/gcc.dg/pr49551.c b/gcc/testsuite/gcc.dg/pr49551.c
new file mode 100644
index 0000000..204f06d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr49551.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdata-sections" } */
+
+int x = 1;
+int x;
+
+/* { dg-final { scan-assembler-not {comm[\t ]+x} } } */