From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 958EE3858020 for ; Thu, 15 Jun 2023 06:24:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 958EE3858020 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5327D1FB; Wed, 14 Jun 2023 23:25:13 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 37F6E3F64C; Wed, 14 Jun 2023 23:24:28 -0700 (PDT) From: Richard Sandiford To: Tamar Christina Mail-Followup-To: Tamar Christina ,Mikael Morin , Richard Earnshaw , "gcc-patches\@gcc.gnu.org" , nd , richard.sandiford@arm.com Cc: Mikael Morin , Richard Earnshaw , "gcc-patches\@gcc.gnu.org" , nd Subject: Re: [PATCH v2] machine descriptor: New compact syntax for insn and insn_split in Machine Descriptions. References: <30f06911-e19a-a39b-9b56-803cc9ef0ec1@orange.fr> Date: Thu, 15 Jun 2023 07:24:26 +0100 In-Reply-To: (Richard Sandiford's message of "Wed, 14 Jun 2023 20:41:28 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-21.7 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Richard Sandiford writes: >> + >> + /* Skip any newlines or whitespaces needed. */ >> + while (ISSPACE(*templ)) >> + templ++; >> + continue; >> + } >> + else if (templ[0] == '/' && templ[1] == '*') >> + { >> + templ += 2; >> + /* Glob till newline or end of multiline comment. */ >> + while (templ[0] != 0 && templ[0] != '*' && templ[1] != '/') >> + templ++; >> + templ += 2; > > Same problem about moving past '\0' here. But the break condition would > stop on things like "*]" or "//", not just "*/". I think it should be: > > for (; templ[0] != 0; ++templ) > if (templ[0] == '*' && templ[1] == '/') > { > templ += 2; > break; > } Actually, I guess it should be: while (templ[0] != '*' || templ[1] != '/') { if (templ[0] == 0) fatal_at (loc, "unterminated '/*'"); templ++; } templ += 2; so that we don't accept unterminated /*. Thanks, Richard