From a41887adad049cbb54f6f6bf260bad55c6f2757d Mon Sep 17 00:00:00 2001 From: kenner Date: Mon, 17 Mar 1997 18:46:42 +0000 Subject: (expr_no_commas): Do not store temporary skip_evaluation increments on yacc value stack; the code was buggy and occasionally wrote past the end of the stack. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13720 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-parse.in | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'gcc/c-parse.in') diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 2a40c5a3ce0..e395f86670e 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1,5 +1,5 @@ /* YACC parser for C syntax and for Objective C. -*-c-*- - Copyright (C) 1987, 88, 89, 92-5, 1996 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 92-6, 1997 Free Software Foundation, Inc. This file is part of GNU CC. @@ -577,27 +577,24 @@ expr_no_commas: { $$ = parser_build_binary_op ($2, $1, $3); } | expr_no_commas ANDAND { $1 = truthvalue_conversion (default_conversion ($1)); - $2 = $1 == boolean_false_node; - skip_evaluation += $2; } + skip_evaluation += $1 == boolean_false_node; } expr_no_commas - { skip_evaluation -= $2; + { skip_evaluation -= $1 == boolean_false_node; $$ = parser_build_binary_op (TRUTH_ANDIF_EXPR, $1, $4); } | expr_no_commas OROR { $1 = truthvalue_conversion (default_conversion ($1)); - $3 = $1 == boolean_true_node; - skip_evaluation += $3; } + skip_evaluation += $1 == boolean_true_node; } expr_no_commas - { skip_evaluation -= $3; + { skip_evaluation -= $1 == boolean_true_node; $$ = parser_build_binary_op (TRUTH_ORIF_EXPR, $1, $4); } | expr_no_commas '?' { $1 = truthvalue_conversion (default_conversion ($1)); - $3 = $1 == boolean_true_node; - $2 = $1 == boolean_false_node; - skip_evaluation += $2; } + skip_evaluation += $1 == boolean_false_node; } expr ':' - { skip_evaluation += $3 - $2; } + { skip_evaluation += (($1 == boolean_true_node) + - ($1 == boolean_false_node)); } expr_no_commas - { skip_evaluation -= $3; + { skip_evaluation -= $1 == boolean_true_node; $$ = build_conditional_expr ($1, $4, $7); } | expr_no_commas '?' { if (pedantic) @@ -605,10 +602,9 @@ expr_no_commas: /* Make sure first operand is calculated only once. */ $2 = save_expr ($1); $1 = truthvalue_conversion (default_conversion ($2)); - $3 = $1 == boolean_true_node; - skip_evaluation += $3; } + skip_evaluation += $1 == boolean_true_node; } ':' expr_no_commas - { skip_evaluation -= $3; + { skip_evaluation -= $1 == boolean_true_node; $$ = build_conditional_expr ($1, $2, $5); } | expr_no_commas '=' expr_no_commas { $$ = build_modify_expr ($1, NOP_EXPR, $3); -- cgit v1.2.1