diff options
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index ebc0783..70e0a2f 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -2126,14 +2126,14 @@ init_attr_rdwr_indices (rdwr_map *rwm, tree attrs) /* The (optional) list of VLA bounds. */ tree vblist = TREE_CHAIN (mode); - if (vblist) - vblist = TREE_VALUE (vblist); - mode = TREE_VALUE (mode); if (TREE_CODE (mode) != STRING_CST) continue; gcc_assert (TREE_CODE (mode) == STRING_CST); + if (vblist) + vblist = nreverse (copy_list (TREE_VALUE (vblist))); + for (const char *m = TREE_STRING_POINTER (mode); *m; ) { attr_access acc = { }; @@ -2308,11 +2308,18 @@ attr_access::to_external_string () const unsigned attr_access::vla_bounds (unsigned *nunspec) const { + unsigned nbounds = 0; *nunspec = 0; - for (const char* p = strrchr (str, ']'); p && *p != '['; --p) - if (*p == '*') - ++*nunspec; - return list_length (size); + /* STR points to the beginning of the specified string for the current + argument that may be followed by the string for the next argument. */ + for (const char* p = strchr (str, ']'); p && *p != '['; --p) + { + if (*p == '*') + ++*nunspec; + else if (*p == '$') + ++nbounds; + } + return nbounds; } /* Reset front end-specific attribute access data from ATTRS. |