[gnu.g++.bug] Bug report, and FIX!

schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/19/89)

Hi,

   There is currently a bug in the g++ 1.32 cplus-parse.y file.
It causes a segmentation fault with the following construct:

----------------------------------------
main () {
   int j = ({1;});
}
----------------------------------------

   I've found the problem with this, and included the patches
for cplus-parse.y below.

   Doug

----------------------------------------
*** cplus-parse.y.~1~	Thu Jan 19 02:24:22 1989
--- cplus-parse.y	Thu Jan 19 02:21:14 1989
***************
*** 641,647 ****
            compstmt ')'
                  { if (pedantic)
                      warning ("ANSI C forbids braced-groups within expressions");
!                   expand_end_stmt_expr ($<ttype>2); }
          | primary '(' exprlist ')'
                  { $$ = build_x_function_call ($1, $3, current_class_decl); }
          | primary '[' expr ']'
--- 641,647 ----
            compstmt ')'
                  { if (pedantic)
                      warning ("ANSI C forbids braced-groups within expressions");
!                   $$ = expand_end_stmt_expr ($<ttype>2); }
          | primary '(' exprlist ')'
                  { $$ = build_x_function_call ($1, $3, current_class_decl); }
          | primary '[' expr ']'
***************
*** 953,959 ****
            compstmt ')'
                  { if (pedantic)
                      warning ("ANSI C forbids braced-groups within expressions");
!                   expand_end_stmt_expr ($<ttype>2); }
          | primary_no_id '(' exprlist ')'
                  { $$ = build_x_function_call ($1, $3, current_class_decl); }
          | primary_no_id '[' expr ']'
--- 953,959 ----
            compstmt ')'
                  { if (pedantic)
                      warning ("ANSI C forbids braced-groups within expressions");
!                   $$ = expand_end_stmt_expr ($<ttype>2); }
          | primary_no_id '(' exprlist ')'
                  { $$ = build_x_function_call ($1, $3, current_class_decl); }
          | primary_no_id '[' expr ']'