aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/nvptx
diff options
context:
space:
mode:
authorCesar Philippidis <cesar@codesourcery.com>2018-03-27 06:54:03 -0700
committerCesar Philippidis <cesar@gcc.gnu.org>2018-03-27 06:54:03 -0700
commit59d2d2383485fb0febdcab9f06bbb3526eeab106 (patch)
treed39392e4fb207df80a67c4babc2179f58edb8f1e /gcc/config/nvptx
parentb36306e9bc664cdbc2f65ecc33867cb7b6e896b3 (diff)
downloadgcc-59d2d2383485fb0febdcab9f06bbb3526eeab106.zip
gcc-59d2d2383485fb0febdcab9f06bbb3526eeab106.tar.gz
gcc-59d2d2383485fb0febdcab9f06bbb3526eeab106.tar.bz2
re PR target/85056 ([nvptx] wrong declaration of external arrays)
PR target/85056 gcc/ * config/nvptx/nvptx.c (nvptx_assemble_decl_begin): Add '[]' to extern array declarations. gcc/testsuite/ * testsuite/gcc.target/nvptx/pr85056.c: New test. * testsuite/gcc.target/nvptx/pr85056a.c: New test. From-SVN: r258885
Diffstat (limited to 'gcc/config/nvptx')
-rw-r--r--gcc/config/nvptx/nvptx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 1ba27e3..b2b150f 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -2033,6 +2033,9 @@ static void
nvptx_assemble_decl_begin (FILE *file, const char *name, const char *section,
const_tree type, HOST_WIDE_INT size, unsigned align)
{
+ bool atype = (TREE_CODE (type) == ARRAY_TYPE)
+ && (TYPE_DOMAIN (type) == NULL_TREE);
+
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
@@ -2072,6 +2075,8 @@ nvptx_assemble_decl_begin (FILE *file, const char *name, const char *section,
/* We make everything an array, to simplify any initialization
emission. */
fprintf (file, "[" HOST_WIDE_INT_PRINT_DEC "]", init_frag.remaining);
+ else if (atype)
+ fprintf (file, "[]");
}
/* Called when the initializer for a decl has been completely output through