From dbf02a2cd6652a1e95cce0ea5035ac394c023a00 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 10 Jan 2019 11:44:46 +0100 Subject: [PATCH] re PR c/88568 ('dllimport' no longer implies 'extern' in C) 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 | 6 ++++++ gcc/attribs.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr88568.c | 4 ++++ 4 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr88568.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e64e1f0fa69..ee2e8fbf95d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-01-10 Jakub Jelinek + + PR c/88568 + * attribs.c (handle_dll_attribute): Clear TREE_STATIC after setting + DECL_EXTERNAL. + 2019-01-10 Tamar Christina * config/arm/arm-builtins.c diff --git a/gcc/attribs.c b/gcc/attribs.c index d9b6a04f87a..408f920dc60 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ba27e1f622..6408435a52d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-10 Jakub Jelinek + + PR c/88568 + * gcc.dg/pr88568.c: New test. + 2019-01-10 Tamar Christina * 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 index 00000000000..65d57d7eb45 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr88568.c @@ -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" } */ -- 2.30.2