From 649e174102a8ae2d570616d09aa336b712e1baae Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Sun, 1 Mar 2020 17:58:45 -0700 Subject: PR middle-end/92721 - checking ICE on attribute access redeclaration gcc/c-family/ChangeLog: PR c++/92721 * c-attribs.c (append_access_attrs): Correctly handle attribute. (handle_access_attribute): Same. gcc/ChangeLog: PR c++/92721 * calls.c (init_attr_rdwr_indices): Correctly handle attribute. gcc/testsuite/ChangeLog: PR c++/92721 g++.dg/ext/attr-access.C: New test. --- gcc/calls.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/calls.c') diff --git a/gcc/calls.c b/gcc/calls.c index d1c5317..4c3a8f3 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1891,8 +1891,13 @@ init_attr_rdwr_indices (rdwr_map *rwm, tree fntype) if (!access) return; + /* The TREE_VALUE of an attribute is a TREE_LIST whose TREE_VALUE + is the attribute argument's value. */ tree mode = TREE_VALUE (access); + gcc_assert (TREE_CODE (mode) == TREE_LIST); + mode = TREE_VALUE (mode); gcc_assert (TREE_CODE (mode) == STRING_CST); + const char *modestr = TREE_STRING_POINTER (mode); for (const char *m = modestr; *m; ) { -- cgit v1.1