[hackers] [scc] [cc1] Clear SEXTERN for global symbols previously declared as extern || Michael Forney

From: <git_AT_suckless.org>
Date: Mon, 20 Feb 2017 22:21:54 +0100 (CET)

commit 149ab2b982334ac3efa9034e595afff1b9df17ad
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Mon Feb 20 13:10:28 2017 -0800
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Feb 20 22:21:19 2017 +0100

    [cc1] Clear SEXTERN for global symbols previously declared as extern

diff --git a/cc1/decl.c b/cc1/decl.c
index 0a5842b..0b696cb 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -703,7 +703,8 @@ redcl(Symbol *sym, Type *tp, Symbol **pars, int sclass)
                 break;
         case NOSCLASS:
                 if ((flags & SPRIVATE) == 0) {
- flags &= ~SEXTERN;
+ if (flags & SEXTERN)
+ flags &= ~(SEXTERN|SEMITTED);
                         flags |= SGLOBAL;
                         break;
                 }
diff --git a/tests/execute/0113-externredecl.c b/tests/execute/0113-externredecl.c
new file mode 100644
index 0000000..0e76572
--- /dev/null
+++ b/tests/execute/0113-externredecl.c
_AT_@ -0,0 +1,8 @@
+extern int x;
+int x;
+
+int
+main()
+{
+ return x;
+}
diff --git a/tests/execute/scc-tests.lst b/tests/execute/scc-tests.lst
index e2938b9..9d42b60 100644
--- a/tests/execute/scc-tests.lst
+++ b/tests/execute/scc-tests.lst
_AT_@ -103,3 +103,4 @@
 0110-typedefcast.c
 0111-doubledef.c
 0112-cond.c
+0113-externredecl.c
Received on Mon Feb 20 2017 - 22:21:54 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2017 - 22:24:18 CET