re PR c/88568 ('dllimport' no longer implies 'extern' in C)
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Jan 2019 10:44:46 +0000 (11:44 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Jan 2019 10:44:46 +0000 (11:44 +0100)
PR c/88568
* attribs.c (handle_dll_attribute): Clear TREE_STATIC after setting
DECL_EXTERNAL.

* gcc.dg/pr88568.c: New test.

From-SVN: r267799

gcc/ChangeLog
gcc/attribs.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr88568.c [new file with mode: 0644]

index e64e1f0fa697ddf490213a11adf36ff5683a3e06..ee2e8fbf95d790469696f08fd2c49e2400b1fcc7 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/88568
+       * attribs.c (handle_dll_attribute): Clear TREE_STATIC after setting
+       DECL_EXTERNAL.
+
 2019-01-10  Tamar Christina  <tamar.christina@arm.com>
 
        * config/arm/arm-builtins.c
index d9b6a04f87af7d9491d180b18bab09664445c557..408f920dc6058ef4ef73b7b51acaaf144566802d 100644 (file)
@@ -1691,6 +1691,8 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
             a function global scope, unless declared static.  */
          if (current_function_decl != NULL_TREE && !TREE_STATIC (node))
            TREE_PUBLIC (node) = 1;
+         /* Clear TREE_STATIC because DECL_EXTERNAL is set.  */
+         TREE_STATIC (node) = 0;
        }
 
       if (*no_add_attrs == false)
index 7ba27e1f6224cae8e04ed56f83539d50933dd62d..6408435a52db49ffc02f465ae6a8122442e9ae85 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/88568
+       * gcc.dg/pr88568.c: New test.
+
 2019-01-10  Tamar Christina  <tamar.christina@arm.com>
 
        * gcc.target/aarch64/advsimd-intrinsics/vector-complex.c: Add AArch32 regexpr.
diff --git a/gcc/testsuite/gcc.dg/pr88568.c b/gcc/testsuite/gcc.dg/pr88568.c
new file mode 100644 (file)
index 0000000..65d57d7
--- /dev/null
@@ -0,0 +1,4 @@
+/* PR c/88568 */
+/* { dg-do compile } */
+/* { dg-require-dll "" } */
+__attribute__((dllimport)) struct S var;       /* { dg-bogus "storage size of .var. isn.t known" } */