aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-01-11 18:03:15 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-01-11 18:03:15 +0000
commit655441d6015134c86c596ba28d079eb6c43b64bf (patch)
tree924047779f9445c7d5f96637e1ba594a1dcf6408 /gcc
parent9cb6bd7432547275c336b7dab5dd4db7a689eabb (diff)
downloadgcc-655441d6015134c86c596ba28d079eb6c43b64bf.zip
gcc-655441d6015134c86c596ba28d079eb6c43b64bf.tar.gz
gcc-655441d6015134c86c596ba28d079eb6c43b64bf.tar.bz2
PR c++/68795: fix uninitialized close_paren_loc in cp_parser_postfix_expression
gcc/cp/ChangeLog: PR c++/68795 * parser.c (cp_parser_postfix_expression): Initialize close_paren_loc to UNKNOWN_LOCATION; only use it if it has been written to by cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Document the behavior with respect to the CLOSE_PAREN_LOC param. From-SVN: r232238
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/parser.c18
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1f12121..023ed64 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2016-01-11 David Malcolm <dmalcolm@redhat.com>
+
+ PR c++/68795
+ * parser.c (cp_parser_postfix_expression): Initialize
+ close_paren_loc to UNKNOWN_LOCATION; only use it if
+ it has been written to by
+ cp_parser_parenthesized_expression_list.
+ (cp_parser_parenthesized_expression_list): Document the behavior
+ with respect to the CLOSE_PAREN_LOC param.
+
2016-01-11 Jakub Jelinek <jakub@redhat.com>
PR c++/69211
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 44dff87..13ed1ef 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -6717,7 +6717,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
bool saved_non_integral_constant_expression_p = false;
tsubst_flags_t complain = complain_flags (decltype_p);
vec<tree, va_gc> *args;
- location_t close_paren_loc;
+ location_t close_paren_loc = UNKNOWN_LOCATION;
is_member_access = false;
@@ -6879,10 +6879,13 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
koenig_p,
complain);
- location_t combined_loc = make_location (token->location,
- start_loc,
- close_paren_loc);
- postfix_expression.set_location (combined_loc);
+ if (close_paren_loc != UNKNOWN_LOCATION)
+ {
+ location_t combined_loc = make_location (token->location,
+ start_loc,
+ close_paren_loc);
+ postfix_expression.set_location (combined_loc);
+ }
/* The POSTFIX_EXPRESSION is certainly no longer an id. */
idk = CP_ID_KIND_NONE;
@@ -7351,7 +7354,10 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
plain identifier argument, normal_attr for an attribute that wants
an expression, or non_attr if we aren't parsing an attribute list. If
NON_CONSTANT_P is non-NULL, *NON_CONSTANT_P indicates whether or
- not all of the expressions in the list were constant. */
+ not all of the expressions in the list were constant.
+ If CLOSE_PAREN_LOC is non-NULL, and no errors occur, then *CLOSE_PAREN_LOC
+ will be written to with the location of the closing parenthesis. If
+ an error occurs, it may or may not be written to. */
static vec<tree, va_gc> *
cp_parser_parenthesized_expression_list (cp_parser* parser,