shithub: scc

Download patch

ref: 1b0aadd3da30f46989a7c24fb712bf0a25605f2a
parent: 9e2ce8d610b9eacac34979540ed8f6dea47b0ed2
author: Michael Forney <mforney@mforney.org>
date: Mon Feb 20 08:10:28 EST 2017

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

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -703,7 +703,8 @@
 		break;
 	case NOSCLASS:
 		if ((flags & SPRIVATE) == 0) {
-			flags &= ~SEXTERN;
+			if (flags & SEXTERN)
+				flags &= ~(SEXTERN|SEMITTED);
 			flags |= SGLOBAL;
 			break;
 		}
--- /dev/null
+++ b/tests/execute/0113-externredecl.c
@@ -1,0 +1,8 @@
+extern int x;
+int x;
+
+int
+main()
+{
+	return x;
+}
--- a/tests/execute/scc-tests.lst
+++ b/tests/execute/scc-tests.lst
@@ -103,3 +103,4 @@
 0110-typedefcast.c
 0111-doubledef.c
 0112-cond.c
+0113-externredecl.c