From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 0FCAB3858C98; Thu, 4 Apr 2024 20:06:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FCAB3858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0FCAB3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712261165; cv=none; b=ZLpBU4GS71e03qkXRXiFXDS1DmbkOifrUG3Hze+A/jR0JmwJm08w4L5BzUgYwISQiVyBtsLNaZd30tn2Zyi4yCdS15Qbm4UqtsUvx+KwxZ1m2yoltMgBhcuIxuNeFcLDyXR3Yhn0LHMVuNdjk0I4LTu6MhdDOneSxSdEpeaSXt0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712261165; c=relaxed/simple; bh=M3vBbEfmRktEGVM8DtHSPje9NSezMtnblU6BhlyA2Ps=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=uAHJaVjyBoNi/3tKkUDC4eFT88emY3NVXLLY2jsbUoPXrStBnKU1s6rATHKmW+bay4jU7vTmzQolFHwSwPzbBnzVXIDyNHjtNPNVOjAhn0pri7Uw1FLE/Bq44DWRcvtU/KxIzRZ46IsDlAPiPrhNd6ExSSrhfrxSI7WhyB5XYqg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5cdbc42f5efso153385a12.0; Thu, 04 Apr 2024 13:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712261161; x=1712865961; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=pk74mhJnQ4YLXJ5pkyBIu2WbcapkAwfMPiZ7ZwiVfUM=; b=D0BDKNwkAj10eWJ7yeM+WiSwJLTxR9qdaftWoo3zDEqzHTFPBn9oQ/uM1/k7++T8GD HJmtwG9QZfkfmK0BED1D0fAJUqCTtPAhS3G9FpN7XWnht4M6oO3iHdMxBkw4RrsFW0YX la+C6sRHghLSDnSsHxDXJqor1srEvbbuKwyQ3xNK7/yJ44KfQ443yrQyrCUmY2drYcrR cWPHfuoH1duvD0qHxM8QWp83TkI6H9MlHqJWZ5dF6pAFXP+b4s/6mgbiy6/QtdcygI68 QgFx1bRwpNwRIKQeWohEHhu+kPD2roSGlDuPIGi8sHHJSMgBLK/YUkWJYm3WNtCWdR/j AL7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712261161; x=1712865961; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pk74mhJnQ4YLXJ5pkyBIu2WbcapkAwfMPiZ7ZwiVfUM=; b=glRP9avSgHZ44+ltRPJdxBITeE7ngQ6KA0JQQ5y8L4GzL4m/s5DGydXL9DzjGxRzF5 Yr/+Hdfz4lEqfA1IUGhuibHmHaxZfuk32KdevEZOXcwKB37cXttzDhc7g82tQ91xfH82 My/8zJYdvuKtFseuW/StMX9gwX4ZdYmenBWu828EcvgIHRHRrek5YWPSpTWI55qBrimc U+imibB+LMrvDbGN1UmUqC00za8uNVo1+ytvS6OCaqaWI2cI7U2znn1HJ31j+WQSdirW KIh8FWsJszD3e79p9InsRJ9lxYUm0bC/x3/mozcOakMJpRVn4pZFXkTmm4+0RZvC4QjB faLw== X-Forwarded-Encrypted: i=1; AJvYcCVCt+2I+5MiOPXO7LlyI4lF8os06q4avSRHXj3OdqGzONkp2YAMicJsSiZPCBqx1i5f30AyAbRl8ZuvAONCEoUY7XrX X-Gm-Message-State: AOJu0YxAQR37MuHb8mJTUyjNJT4TKwopDKyAIffq+xwTTUk7RiAjyFpq mbk0+hHY91LMTXDDryEt/8BO11L3+EEf4VOdW/NvIpjyZpdx4IA3ExAgmvNM X-Google-Smtp-Source: AGHT+IFUgLuV44dalCfYWO9Zs3vFv1n9YN+RHlCGia8LlNhJIRsYf7hMLGaZthEiQD7r4xRyyj5EPg== X-Received: by 2002:a05:6a20:da90:b0:1a3:c621:da8d with SMTP id iy16-20020a056a20da9000b001a3c621da8dmr3978696pzb.1.1712261161447; Thu, 04 Apr 2024 13:06:01 -0700 (PDT) Received: from [192.168.1.20] ([50.37.177.113]) by smtp.gmail.com with ESMTPSA id i18-20020a056a00005200b006ecfd2ad989sm27600pfk.169.2024.04.04.13.06.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Apr 2024 13:06:01 -0700 (PDT) Message-ID: <63b8d035-47cf-4d1d-9df1-8337d85070c1@gmail.com> Date: Thu, 4 Apr 2024 13:05:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: =?UTF-8?Q?Re=3A_=5Bpatch=2C_libgfortran=5D_PR114304_-_=5B13/14_Regr?= =?UTF-8?Q?ession=5D_libgfortran_I/O_=E2=80=93_bogus_=22Semicolon_not_allowe?= =?UTF-8?Q?d_as_separator_with_DECIMAL=3D=27point=27=22?= To: Tobias Burnus , gfortran Cc: gcc-patches References: <9a848b89-ee95-44f7-8491-cbe22804edf4@gmail.com> Content-Language: en-US From: Jerry D Autocrypt: addr=jvdelisle2@gmail.com; keydata= xjMEY5TlkxYJKwYBBAHaRw8BAQdAyrkRDhmJhSTTlV/50gJLlvliU6/Lm5C9ViKV8T9y1GnN HkplcnJ5IEQgPGp2ZGVsaXNsZTJAZ21haWwuY29tPsKJBBMWCAAxFiEEOFR0TS0390uh8dRV uWXAJaWpwWoFAmOU5ZMCGwMECwkIBwUVCAkKCwUWAgMBAAAKCRC5ZcAlpanBalsJAP4wdCiH 2Of9oZv1QWgZ/AVdbWFM3Fv47/WZQHOXfoZ9HgD6AkXrKeJ+6usST7PEaDJjptaViT1fLiYY V/6XaOKSsgLOOARjlOWTEgorBgEEAZdVAQUBAQdAdA7PczYnl07vnOT9oP/wvvMDd4HP09Zl g3LzwXQJWT8DAQgHwngEGBYIACAWIQQ4VHRNLTf3S6Hx1FW5ZcAlpanBagUCY5TlkwIbDAAK CRC5ZcAlpanBasF/AQCa5WjlsVpLsEiggZyT18MOJNAdeRd7wkGDUrwedHrvawD/cE1H+/Ms L1ZwvQiLfGdx8crigQqWTQyos4kH8Wx82wc= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 4/4/24 2:31 AM, Tobias Burnus wrote: > Hi Jerry, > > Jerry D wrote: >> The attached log entry and patch (git show) fixes this issue by adding >> logic to handle spaces in eat_separators. One or more spaces by >> themselves are a valid separator. So in this case we look at the >> character following the spaces to see if it is a comma or semicolon. >> >> If so, I change it to the valid separator for the given decimal mode, >> point or comma. This allows the comma or semicolon to be interpreted >> as a null read on the next effective item in the formatted read. >> >> I chose a permissive approach here that allows reads to proceed when the >> input line is mal-formed with an incorrect separator as long as there >> is at least one space in front of it. > > First: Consider also adding 'PR fortran/105473' to the commit log > as the PRs are closely related, albeit this PR is different- > > The patch looks mostly like I would expect, except for decimal='point' > and a ';' which is *not* preceded by a space. > > Thanks for working on it. > > Regarding the 'except' case: > > * * * > > If I try your patch with the testcase of at comment 19, > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114304#c19 > → https://gcc.gnu.org/bugzilla/attachment.cgi?id=57695 , > > I do note that with 'decimal=point', a tailing semicolon is silently > accepted – even if not proceeded by a space. I did that on purpose out of leniency and fear of breaking something. I will add that in and do some testing. > > I think such code is invalid – and you could consider to reject it. > Otherwise, the handling all seems to be in line with the Fortran spec. > > i.e. for the following string, I had *expected an error*: I will see what it does. I agree in principle. > >  point, isreal =  F , testinput = ";"n=          42  ios=           0 >  point, isreal =  F , testinput = "5;"n=           5  ios=           0 >  point, isreal =  T , testinput = "8;"r=   8.00000000      ios= 0 >  point, isreal =  T , testinput = "3.3;"r=   3.29999995      ios= 0 >  point, isreal =  T , testinput = "3,3;"r=   3.00000000      ios= 0 > > while I think the following is OK (i.e. no error is what I expect) due > to the the space before the ';'. Agree and this is what I was attempting. > >  point, isreal =  F , testinput = "7 ;"n=           7  ios= 0 >  point, isreal =  T , testinput = "9 ;"r=   9.00000000      ios= 0 >  point, isreal =  T , testinput = "4.4 ;"r=   4.40000010      ios=0 >  point, isreal =  T , testinput = "9 ;"r=   9.00000000      ios= 0 >  point, isreal =  T , testinput = "4,4 ;"r=   4.00000000      ios= 0 > > * * * > > Looking at the other compilers, ifort, ifx and Flang do issue an error > here. Likewise, g95 seems to yield an error in this case (see below). > > I do note that the Lapack testcase that triggered this PR did have such > a code - but it was then changed because g95 did not like it: > > https://github.com/Reference-LAPACK/lapack/commit/64e8a7500d817869e5fcde35afd39af8bc7a8086 > I am glad they fixed that, it triggered a whole lot of cycles here. > In terms of gfortran: until recently did accept it (all versions, > including 13+14); it then rejected it due to the change in PR105473 (GCC > 14/mainline, backported to 13)– but I now think it rightly did so. With > the current patch, it is accepted again. > > * * * > > I have attached the modified testcase linked above; consider adding it > as well. - Changes to the one of the attachment: > - I added a few additional (albeit boring) tests > - I added an expected output + error diagnostic. > > The testcase assumes an error for ';' as separator (with 'point'), > unless there is a space before it. > > [If we want to not diagnose this as vendor extension, we really need to > add a comment to that testcase besides changing valid = .false. to .true.] I have gone back and forth on this issue many times trying to find the middle ground. The standard is fairly clear. To me it is on the user to not use malformed input so allowing with the intervening space we are simply ignoring the trailing ',' or ';' and calling the spaces sufficient as a valid separator. Regardless I now have your modified test case passing. Much appreciated. Thanks for the reviews. I will resubmit when I can, hopefully today. Cheers, Jerry