From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7702 invoked by alias); 9 Sep 2005 15:58:52 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7682 invoked by uid 48); 9 Sep 2005 15:58:48 -0000 Date: Fri, 09 Sep 2005 15:58:00 -0000 Message-ID: <20050909155848.7679.qmail@sourceware.org> From: "tobi at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050816120759.23420.tkoenig@gcc.gnu.org> References: <20050816120759.23420.tkoenig@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug fortran/23420] ICE on invalid print statement X-Bugzilla-Reason: CC X-SW-Source: 2005-09/txt/msg01142.txt.bz2 List-Id: ------- Additional Comments From tobi at gcc dot gnu dot org 2005-09-09 15:58 ------- This patch fixes the problem in match_io.c, but leaves us with a preexisting deficiency in I/O statement parsing: PRINT I+I END will now segfault in trans-io.c. Index: io.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/fortran/io.c,v retrieving revision 1.31 diff -c -3 -p -r1.31 io.c *** io.c 4 Sep 2005 12:08:40 -0000 1.31 --- io.c 9 Sep 2005 15:38:07 -0000 *************** match_io (io_kind k) *** 2133,2169 **** if (gfc_match_char ('(') == MATCH_NO) { if (k == M_WRITE) goto syntax; ! else if (k == M_PRINT ! && (gfc_current_form == FORM_FIXED ! || gfc_peek_char () == ' ')) { /* Treat the non-standard case of PRINT namelist. */ ! where = gfc_current_locus; ! if ((gfc_match_name (name) == MATCH_YES) ! && !gfc_find_symbol (name, NULL, 1, &sym) ! && sym->attr.flavor == FL_NAMELIST) { ! if (gfc_notify_std (GFC_STD_GNU, "PRINT namelist at " ! "%C is an extension") == FAILURE) { ! m = MATCH_ERROR; ! goto cleanup; } ! if (gfc_match_eos () == MATCH_NO) ! { ! gfc_error ("Namelist followed by I/O list at %C"); ! m = MATCH_ERROR; ! goto cleanup; ! } ! ! dt->io_unit = default_unit (k); ! dt->namelist = sym; ! goto get_io_list; } - else - gfc_current_locus = where; } if (gfc_current_form == FORM_FREE) --- 2133,2170 ---- if (gfc_match_char ('(') == MATCH_NO) { + where = gfc_current_locus if (k == M_WRITE) goto syntax; ! else if (k == M_PRINT) { /* Treat the non-standard case of PRINT namelist. */ ! if ((gfc_current_form == FORM_FIXED || gfc_peek_char () == ' ') ! && gfc_match_name (name) == MATCH_YES) { ! gfc_find_symbol (name, NULL, 1, &sym); ! if (sym && sym->attr.flavor == FL_NAMELIST) { ! if (gfc_notify_std (GFC_STD_GNU, "PRINT namelist at " ! "%C is an extension") == FAILURE) ! { ! m = MATCH_ERROR; ! goto cleanup; ! } ! if (gfc_match_eos () == MATCH_NO) ! { ! gfc_error ("Namelist followed by I/O list at %C"); ! m = MATCH_ERROR; ! goto cleanup; ! } ! ! dt->io_unit = default_unit (k); ! dt->namelist = sym; ! goto get_io_list; } ! else ! gfc_current_locus = where; } } if (gfc_current_form == FORM_FREE) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23420