public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist
@ 2020-11-26 12:58 layzarc at aol dot com
  2020-11-26 14:13 ` [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff marxin at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: layzarc at aol dot com @ 2020-11-26 12:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

            Bug ID: 98017
           Summary: Suspected regression (relative to 7.5) using PACK in
                    iolist
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: layzarc at aol dot com
  Target Milestone: ---

Created attachment 49632
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49632&action=edit
Source with compilation and execution for both gfortran 7.5 and 9.3 (ubuntu
20.04)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
@ 2020-11-26 14:13 ` marxin at gcc dot gnu.org
  2020-11-27 20:22 ` anlauf at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-26 14:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-11-26
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |tkoenig at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
            Summary|Suspected regression        |[8/9/10/11 Regression]
                   |(relative to 7.5) using     |Suspected regression
                   |PACK in iolist              |(relative to 7.5) using
                   |                            |PACK in iolist since
                   |                            |r8-4151-g6c6bde30706c29ff

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r8-4151-g6c6bde30706c29ff.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
  2020-11-26 14:13 ` [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff marxin at gcc dot gnu.org
@ 2020-11-27 20:22 ` anlauf at gcc dot gnu.org
  2020-11-28 21:32 ` anlauf at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-27 20:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
It's much more interesting than a mere regression.

Reduced and modified testcase:

program p
  implicit none
  integer :: i
  character(*), parameter :: exprs(1) = ['abc()']
  print *, (pack(exprs,exprs(:)(:1)=='a'),i=1,1)
  print *, (pack(exprs,exprs(:)(:1)=='a')      )
end

7.4.1 gives:

 abc()
 a

8.4.1 and later give:

 a
 a

Expected output:

 abc()
 abc()

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
  2020-11-26 14:13 ` [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff marxin at gcc dot gnu.org
  2020-11-27 20:22 ` anlauf at gcc dot gnu.org
@ 2020-11-28 21:32 ` anlauf at gcc dot gnu.org
  2020-11-28 22:02 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-28 21:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

--- Comment #3 from anlauf at gcc dot gnu.org ---
Further reduced variant:

program p
  implicit none
  character(*), parameter :: exprs(1) = ['abc()']
  print *,  len (pack ( exprs   , exprs(:)(:1) =='a'))
  print *,  len (pack (['abc()'],['abc()' (:1)]=='a'))
end

gcc-7 prints:

           5
           5

while 8 and newer print:

           1
           5

My debugging attempts so far suggest that this part of expr.c corrupts the
string length:

227       if (e->expr_type == EXPR_VARIABLE && e->rank > 0
228           && e->symtree->n.sym->attr.flavor == FL_PARAMETER)
229         gfc_simplify_expr (e, 1);

After gfc_simplify_expr (e, 1),

(gdb) p *e->ts.u.cl->length->value.integer._mp_d                  
$34 = 1

for the first variant, while we don't simplify for the second and keep

(gdb) p *e->ts.u.cl->length->value.integer._mp_d
$37 = 5

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (2 preceding siblings ...)
  2020-11-28 21:32 ` anlauf at gcc dot gnu.org
@ 2020-11-28 22:02 ` anlauf at gcc dot gnu.org
  2020-11-28 22:17 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-28 22:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
               Host|ubuntu 20.04                |
           Keywords|                            |wrong-code
           Priority|P3                          |P4
   Target Milestone|---                         |8.5
             Status|NEW                         |ASSIGNED

--- Comment #4 from anlauf at gcc dot gnu.org ---
I have a patch.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (3 preceding siblings ...)
  2020-11-28 22:02 ` anlauf at gcc dot gnu.org
@ 2020-11-28 22:17 ` anlauf at gcc dot gnu.org
  2020-11-29 22:25 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-28 22:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

--- Comment #5 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2020-November/055367.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (4 preceding siblings ...)
  2020-11-28 22:17 ` anlauf at gcc dot gnu.org
@ 2020-11-29 22:25 ` cvs-commit at gcc dot gnu.org
  2020-12-06 21:41 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-29 22:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:bb67ad5cff58a707aaae645d4f45a913d8511c86

commit r11-5526-gbb67ad5cff58a707aaae645d4f45a913d8511c86
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sun Nov 29 23:23:16 2020 +0100

    PR fortran/98017 - Suspected regression using PACK

    When substituting a parameter variable of type character, the character
    length was reset to 1.  Fix this by copying the length.

    gcc/fortran/ChangeLog:

            * expr.c (simplify_parameter_variable): Fix up character length
            after copying an array-valued expression.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr98017.f90: New test.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (5 preceding siblings ...)
  2020-11-29 22:25 ` cvs-commit at gcc dot gnu.org
@ 2020-12-06 21:41 ` cvs-commit at gcc dot gnu.org
  2020-12-11 21:28 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-06 21:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:86c580ded1d58c4e06165d38a0f447d587152179

commit r10-9125-g86c580ded1d58c4e06165d38a0f447d587152179
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sun Nov 29 23:23:16 2020 +0100

    PR fortran/98017 - Suspected regression using PACK

    When substituting a parameter variable of type character, the character
    length was reset to 1.  Fix this by copying the length.

    gcc/fortran/ChangeLog:

            * expr.c (simplify_parameter_variable): Fix up character length
            after copying an array-valued expression.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr98017.f90: New test.

    (cherry picked from commit bb67ad5cff58a707aaae645d4f45a913d8511c86)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (6 preceding siblings ...)
  2020-12-06 21:41 ` cvs-commit at gcc dot gnu.org
@ 2020-12-11 21:28 ` cvs-commit at gcc dot gnu.org
  2020-12-11 21:46 ` cvs-commit at gcc dot gnu.org
  2020-12-11 21:49 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-11 21:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:342be4dce16630575e2de21dbeec4baaed7a143a

commit r9-9109-g342be4dce16630575e2de21dbeec4baaed7a143a
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sun Nov 29 23:23:16 2020 +0100

    PR fortran/98017 - Suspected regression using PACK

    When substituting a parameter variable of type character, the character
    length was reset to 1.  Fix this by copying the length.

    gcc/fortran/ChangeLog:

            * expr.c (simplify_parameter_variable): Fix up character length
            after copying an array-valued expression.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr98017.f90: New test.

    (cherry picked from commit bb67ad5cff58a707aaae645d4f45a913d8511c86)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (7 preceding siblings ...)
  2020-12-11 21:28 ` cvs-commit at gcc dot gnu.org
@ 2020-12-11 21:46 ` cvs-commit at gcc dot gnu.org
  2020-12-11 21:49 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-11 21:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:56f83e64e179f2ff5bb4161db076d7e6ae1c0a3f

commit r8-10675-g56f83e64e179f2ff5bb4161db076d7e6ae1c0a3f
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Sun Nov 29 23:23:16 2020 +0100

    PR fortran/98017 - Suspected regression using PACK

    When substituting a parameter variable of type character, the character
    length was reset to 1.  Fix this by copying the length.

    gcc/fortran/ChangeLog:

            * expr.c (simplify_parameter_variable): Fix up character length
            after copying an array-valued expression.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/pr98017.f90: New test.

    (cherry picked from commit bb67ad5cff58a707aaae645d4f45a913d8511c86)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff
  2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
                   ` (8 preceding siblings ...)
  2020-12-11 21:46 ` cvs-commit at gcc dot gnu.org
@ 2020-12-11 21:49 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-12-11 21:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98017

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from anlauf at gcc dot gnu.org ---
Fixed on master for gcc-11, and backported to 10-branch, as well as 9- and
8-branches with minor adjustment.  Closing.

Thanks for the report!

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-11 21:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26 12:58 [Bug fortran/98017] New: Suspected regression (relative to 7.5) using PACK in iolist layzarc at aol dot com
2020-11-26 14:13 ` [Bug fortran/98017] [8/9/10/11 Regression] Suspected regression (relative to 7.5) using PACK in iolist since r8-4151-g6c6bde30706c29ff marxin at gcc dot gnu.org
2020-11-27 20:22 ` anlauf at gcc dot gnu.org
2020-11-28 21:32 ` anlauf at gcc dot gnu.org
2020-11-28 22:02 ` anlauf at gcc dot gnu.org
2020-11-28 22:17 ` anlauf at gcc dot gnu.org
2020-11-29 22:25 ` cvs-commit at gcc dot gnu.org
2020-12-06 21:41 ` cvs-commit at gcc dot gnu.org
2020-12-11 21:28 ` cvs-commit at gcc dot gnu.org
2020-12-11 21:46 ` cvs-commit at gcc dot gnu.org
2020-12-11 21:49 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).