{"id":2219694,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2219694/?format=json","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.0/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<17bb425b-52ec-4045-94bd-643d38419053@gmail.com>","date":"2026-04-03T20:07:01","name":"[libgfortran] Fix return value for ENCODING in INQUIRE","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"4a0bf2ee9a9bd14b707a4f501ce086bfb3537ae3","submitter":{"id":78264,"url":"http://patchwork.ozlabs.org/api/1.0/people/78264/?format=json","name":"Jerry D","email":"jvdelisle2@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/17bb425b-52ec-4045-94bd-643d38419053@gmail.com/mbox/","series":[{"id":498670,"url":"http://patchwork.ozlabs.org/api/1.0/series/498670/?format=json","date":"2026-04-03T20:07:01","name":"[libgfortran] Fix return value for ENCODING in INQUIRE","version":1,"mbox":"http://patchwork.ozlabs.org/series/498670/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2219694/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=mjBEoC2a;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=mjBEoC2a","sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","sourceware.org; spf=pass smtp.mailfrom=gmail.com","server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.214.169"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnVC444B2z1yG2\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 07:07:39 +1100 (AEDT)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 364744BA23DB\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  3 Apr 2026 20:07:35 +0000 (GMT)","from mail-pl1-f169.google.com (mail-pl1-f169.google.com\n [209.85.214.169])\n by sourceware.org (Postfix) with ESMTPS id BF3D94BA23DB\n for <gcc-patches@gcc.gnu.org>; Fri,  3 Apr 2026 20:07:03 +0000 (GMT)","by mail-pl1-f169.google.com with SMTP id\n d9443c01a7336-2b0ba3bfe16so25776425ad.1\n for <gcc-patches@gcc.gnu.org>; Fri, 03 Apr 2026 13:07:03 -0700 (PDT)","from [10.168.168.23] ([50.37.179.80])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b274756621sm63991735ad.20.2026.04.03.13.07.01\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Fri, 03 Apr 2026 13:07:01 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 364744BA23DB","OpenDKIM Filter v2.11.0 sourceware.org BF3D94BA23DB"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org BF3D94BA23DB","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org BF3D94BA23DB","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775246824; cv=none;\n b=Z12QI2B4oMM+n/ezn6B1azu22UILEN9sMfENQ3V2XgKMA5D0eCuosKC97+diCrrhZ8eLb7UJXPtGPPNpQzmALDL0mSQdkBkpUysemZyoK7jF4SMuWboqkdndz2jx/nhpzarZsPvroMBy7zvk0L9RQktkP7Rf/EyC4mEY6fkZ+Ek=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775246824; c=relaxed/simple;\n bh=B6qj6Shl/q/xtjZEAvDJCZLq8TR3K7beTcFHEkCTS7Q=;\n h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject;\n b=HNktkpfMIsO9Sjz/CD9sUk4Yl6crqJiBlAAPDq3nGrmCf5h95gFn8Ycq/oIzP3ToelSrDQOEVkK5tsgz53n0Eh0CLLYF6q0KrXUb3DUUoQe8B+zK3wKFRgVD4t9IR7sb4pKITI/f1g3CPUTh7PplkcGsxh8wnQB6inqJ2Yjr5Q4=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775246823; x=1775851623; darn=gcc.gnu.org;\n h=autocrypt:subject:from:cc:to:content-language:user-agent\n :mime-version:date:message-id:from:to:cc:subject:date:message-id\n :reply-to; bh=Rqc+DtuxKIdY46bIr+h07HXS4SZjNNGCnqZP+J6VlQQ=;\n b=mjBEoC2aR8NeIg5uOiwqWGTtzK/Acui+NKtQaluD2RVnK2TVh/nA490/khkIC335ZB\n BXNAKMGYfn8UVBRJUL0HrOSmzxCeLEquYOfTtEtS5nNRJSGRddFs8jM/Qy6q3LxesqPQ\n +8Y/558MUmqJRGckJHAg2rwEyBEpcuD4H5VaHt84t57P8p7LGm81l3NUmEw/25AxWChr\n OEmCnfhC11j7O/6AZ3YnbFIErVhCu83gDMV8BlhTTHeAPBvQaL56YWJPfVUCQ3YQenx/\n M54ysluDlDaE9kzWrklU63UC4H5fkAWJx9JrvcY+u991z2quUPjqvLU88MsLnfSMmUsz\n 69dw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775246823; x=1775851623;\n h=autocrypt:subject:from:cc:to:content-language:user-agent\n :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=Rqc+DtuxKIdY46bIr+h07HXS4SZjNNGCnqZP+J6VlQQ=;\n b=li28nMyIahVUyRfKmHXL+7hJGMgXdcNfCH3aPjsKy1A3oZMRMrUhEzY/KsjSn9BP31\n 7dha8fFHgUNyPegPYgbjMwkDi6K8hH+i2VliE3e07dn6MwS5ky9vZCZhVyKyK+EM84Pg\n dXteolzdTVN+kzz1hKtOg1ctDCwMqQNjHQ7I8c+1Yo3ssxGANQB/UxvcYMso7/srJS+P\n VsVUJ30ZWnfdGCwQHQSQK+QSqwzJZw8whE/m3tyhRWdUb7oja+u7e+WM0yb41Lr4neCP\n DLxa8kcHGfaoH6dm5giLHU/086WnRyHhnhUGsNzx/pI3qPrtu2cpCPkYrBjKZuCbfBI2\n +RDw==","X-Forwarded-Encrypted":"i=1;\n AJvYcCWxpStDf64JbQPr6Xz1EmxkBA5Cu1BA8wm8CunBcnWQMlDA3It7W5jnqyIiBzS89C6GTmXpZY/fvUoPgw==@gcc.gnu.org","X-Gm-Message-State":"AOJu0Yz/ajrm59Iy1RPFez20qd1gtLEHXghTAhD1k4veuLDXHMqt3vcX\n 6W5bz99Ee2OvncAKKg6QmtPVYHM1pzhuvVBZRzFcuqQQsS11BUt8PbHe","X-Gm-Gg":"AeBDievuXzX5ylQBaxucH35Q7/+ipFn9K5s/QXw9jfKu216t5I/slaz0oTqp6+Epwmz\n T0txvGQt1s4uQhKeK+5AT5e5t31HgO1tdU+4TE8fUEob1bd32qJj+RZ/A1QXw7HDEELoB0NoFJo\n p3IoU+eqefgdn5IYJtH87s9K+ajWOPmXdz4O/ECMIsxkj/mTN/7BkNczSyuhCQz32xC7SGWg3en\n hUfutdHTk81gfQtiK0ns2xBK8H77RYttP8422Dwa/q01FmVVnoIo9y5atGQ6qyx22O7zuoJ69dy\n HTxNxgoY+RZ5Wr0ec9w8T0E34XqyPIfxCKL1sjFusQeyApWAyDVI9yIrYGAfu+mpkL6VBhZD/8f\n 20MKrhp0UYIQW28Bp7Oa7QCCpUqbsC3Z8TEwVEu0XWNJrXDOFWWyPTLRTaZSja3/VkwCYMF26O0\n YCICC7awB/J9bIy5+lcVD++M/Pzn0=","X-Received":"by 2002:a17:903:b8e:b0:2b0:5450:a910 with SMTP id\n d9443c01a7336-2b28219df6emr41951145ad.17.1775246822666;\n Fri, 03 Apr 2026 13:07:02 -0700 (PDT)","Content-Type":"multipart/mixed; boundary=\"------------bR9pRPKvw705x1JyP6F9x1pO\"","Message-ID":"<17bb425b-52ec-4045-94bd-643d38419053@gmail.com>","Date":"Fri, 3 Apr 2026 13:07:01 -0700","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Content-Language":"en-US","To":"gfortran <fortran@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>","Cc":"w6ws@earthlink.net","From":"Jerry D <jvdelisle2@gmail.com>","Subject":"[patch, libgfortran] Fix return value for ENCODING in INQUIRE","Autocrypt":"addr=jvdelisle2@gmail.com; keydata=\n xjMEY5TlkxYJKwYBBAHaRw8BAQdAyrkRDhmJhSTTlV/50gJLlvliU6/Lm5C9ViKV8T9y1GnN\n HkplcnJ5IEQgPGp2ZGVsaXNsZTJAZ21haWwuY29tPsKJBBMWCAAxFiEEOFR0TS0390uh8dRV\n uWXAJaWpwWoFAmOU5ZMCGwMECwkIBwUVCAkKCwUWAgMBAAAKCRC5ZcAlpanBalsJAP4wdCiH\n 2Of9oZv1QWgZ/AVdbWFM3Fv47/WZQHOXfoZ9HgD6AkXrKeJ+6usST7PEaDJjptaViT1fLiYY\n V/6XaOKSsgLOOARjlOWTEgorBgEEAZdVAQUBAQdAdA7PczYnl07vnOT9oP/wvvMDd4HP09Zl\n g3LzwXQJWT8DAQgHwngEGBYIACAWIQQ4VHRNLTf3S6Hx1FW5ZcAlpanBagUCY5TlkwIbDAAK\n CRC5ZcAlpanBasF/AQCa5WjlsVpLsEiggZyT18MOJNAdeRd7wkGDUrwedHrvawD/cE1H+/Ms\n L1ZwvQiLfGdx8crigQqWTQyos4kH8Wx82wc=","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"The attached patch is very simple. This provides for the case where a UNIT or \nFILE is connected as unformatted vs formatted.\n\nMinor adjustment to existing test case.\n\nRegression tested on x86_64\n\nThanks Walter for spotting this.\n\nI will commit this later tonight.\n\nRegards,\n\nJerry\n\nAuthor: Jerry DeLisle <jvdelisle@gcc.gnu.org>\nDate:   Fri Apr 3 10:17:03 2026 -0700\n\n     fortran: Minor adjustment to INQUIRE for ENCODING=\n\n             PR libfortran/124543\n\n     libgfortran/ChangeLog:\n\n             * io/inquire.c (inquire_via_unit): Adjust the logic to\n             treat formatted vs unformatted correctly.\n\n     gcc/testsuite/ChangeLog:\n\n             * gfortran.dg/pr124543.f90: Set result to 'UNDEFINED' in two\n             places.","diff":"commit 841f1422c1e6f5b09968d453e49950ac65993955\nAuthor: Jerry DeLisle <jvdelisle@gcc.gnu.org>\nDate:   Fri Apr 3 10:17:03 2026 -0700\n\n    fortran: Minor adjustment to INQUIRE for ENCODING=\n    \n            PR libfortran/124543\n    \n    libgfortran/ChangeLog:\n    \n            * io/inquire.c (inquire_via_unit): Adjust the logic to\n            treat formatted vs unformatted correctly.\n    \n    gcc/testsuite/ChangeLog:\n    \n            * gfortran.dg/pr124543.f90: Set result to 'UNDEFINED' in two\n            places.\n\ndiff --git a/gcc/testsuite/gfortran.dg/pr124543.f90 b/gcc/testsuite/gfortran.dg/pr124543.f90\nindex 7a7f15dd391..2ab5b5a023b 100644\n--- a/gcc/testsuite/gfortran.dg/pr124543.f90\n+++ b/gcc/testsuite/gfortran.dg/pr124543.f90\n@@ -202,7 +202,7 @@ program inq_tests\n   inquire (unit=lun, decimal=decimal, encoding=encoding, pos=pos,  &\n       round=round, sign=signc, stream=stream, iostat=iostat)\n   if  (decimal /= 'POINT' .or. (iostat /= 0)) stop 204\n-  if  (encoding /= 'UNKNOWN') stop 205\n+  if  (encoding /= 'UNDEFINED') stop 205\n   if  (round /= 'PROCESSOR_DEFINED') stop 206\n   if  (signc /= 'PROCESSOR_DEFINED') stop 207\n   if  (stream /= 'NO') stop 208\n@@ -284,7 +284,7 @@ program inq_tests\n   inquire (unit=lun, decimal=decimal, encoding=encoding, pos=pos,  &\n       round=round, sign=signc, stream=stream, iostat=iostat)\n   if  (decimal /= 'UNDEFINED' .or. (iostat /= 0)) stop 286\n-  if  (encoding /= 'UNKNOWN') stop 287\n+  if  (encoding /= 'UNDEFINED') stop 287\n   if  (round /= 'PROCESSOR_DEFINED') stop 288\n   if  (signc /= 'PROCESSOR_DEFINED') stop 289\n   if  (stream /= 'YES') stop 290\ndiff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c\nindex f96210f1d57..4d773349fa3 100644\n--- a/libgfortran/io/inquire.c\n+++ b/libgfortran/io/inquire.c\n@@ -311,13 +311,13 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u)\n \n       if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)\n \t{\n-\t  if (u == NULL || u->flags.form != FORM_FORMATTED)\n+\t  if (u == NULL)\n \t    p = \"UNKNOWN\";\n-          else\n+\t  else if (u->flags.form == FORM_FORMATTED)\n \t    switch (u->flags.encoding)\n \t      {\n \t      case ENCODING_DEFAULT:\n-\t\tp = \"UNKNOWN\";\n+\t\tp = \"UNDEFINED\";\n \t\tbreak;\n \t      case ENCODING_UTF8:\n \t\tp = \"UTF-8\";\n@@ -325,6 +325,8 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit *u)\n \t      default:\n \t\tinternal_error (&iqp->common, \"inquire_via_unit(): Bad encoding\");\n \t      }\n+\t    else\n+\t      p = \"UNKNOWN\";\n \n \t  cf_strcpy (iqp->encoding, iqp->encoding_len, p);\n \t}\n","prefixes":["libgfortran"]}