public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/113883] New: allocatable length parameter used but is undefined
@ 2024-02-12  3:07 kargl at gcc dot gnu.org
  2024-02-12  3:09 ` [Bug fortran/113883] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-02-12  3:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113883
           Summary: allocatable length parameter used but is undefined
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kargl at gcc dot gnu.org
  Target Milestone: ---

All,

I stumbled across the following issue with my code.  Consider, 

! { dg-do compile }
! { dg-options "-Werror -Wall" }
module foo
   contains
      subroutine bar 
         character(len=:), allocatable :: s(:)
         call bah(s)
      end subroutine bar
end module foo

Currently, if this compiled with '-Werror -Wall' the result is

% gfcx -Wall -Werror -c gcc/testsuite/gfortran.dg/allocatable_length.f90
gcc/testsuite/gfortran.dg/allocatable_length.f90:6:46:

    6 |          character(len=:), allocatable :: s(:)
      |                                              ^
Error: '.s' is used uninitialized [-Werror=uninitialized]
gcc/testsuite/gfortran.dg/allocatable_length.f90:5:20:

    5 |       subroutine bar
      |                    ^
note: '.s' was declared here
f951: all warnings being treated as errors

I tracked down the location where the issue occurs and Mikael suggested
the patch that ultimately fixes the issue.  I'll attach it in a follow-up.

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

* [Bug fortran/113883] allocatable length parameter used but is undefined
  2024-02-12  3:07 [Bug fortran/113883] New: allocatable length parameter used but is undefined kargl at gcc dot gnu.org
@ 2024-02-12  3:09 ` kargl at gcc dot gnu.org
  2024-02-12  3:09 ` kargl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-02-12  3:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from kargl at gcc dot gnu.org ---
Created attachment 57389
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57389&action=edit
patch to fix bug

This is the patch and testcase.  I have successfully bootstrapped
and run the Fortran regression tests without issues.

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

* [Bug fortran/113883] allocatable length parameter used but is undefined
  2024-02-12  3:07 [Bug fortran/113883] New: allocatable length parameter used but is undefined kargl at gcc dot gnu.org
  2024-02-12  3:09 ` [Bug fortran/113883] " kargl at gcc dot gnu.org
@ 2024-02-12  3:09 ` kargl at gcc dot gnu.org
  2024-02-12 20:00 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2024-02-12  3:09 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-02-12
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

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

* [Bug fortran/113883] allocatable length parameter used but is undefined
  2024-02-12  3:07 [Bug fortran/113883] New: allocatable length parameter used but is undefined kargl at gcc dot gnu.org
  2024-02-12  3:09 ` [Bug fortran/113883] " kargl at gcc dot gnu.org
  2024-02-12  3:09 ` kargl at gcc dot gnu.org
@ 2024-02-12 20:00 ` jvdelisle at gcc dot gnu.org
  2024-02-13  4:51 ` cvs-commit at gcc dot gnu.org
  2024-02-13 17:20 ` sgk at troutmask dot apl.washington.edu
  4 siblings, 0 replies; 6+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2024-02-12 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

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

--- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I should be able to commit this. The patch looks good.  I have one other thing
to do in front of this.

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

* [Bug fortran/113883] allocatable length parameter used but is undefined
  2024-02-12  3:07 [Bug fortran/113883] New: allocatable length parameter used but is undefined kargl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-02-12 20:00 ` jvdelisle at gcc dot gnu.org
@ 2024-02-13  4:51 ` cvs-commit at gcc dot gnu.org
  2024-02-13 17:20 ` sgk at troutmask dot apl.washington.edu
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-13  4:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:

https://gcc.gnu.org/g:6caec7d9ec37e60e718a12934c85bac9c12757ac

commit r14-8947-g6caec7d9ec37e60e718a12934c85bac9c12757ac
Author: Steve Kargl <kargl@gcc.gnu.org>
Date:   Mon Feb 12 20:41:02 2024 -0800

    Fortran: Set the length of an allocatable character

            PR fortran/113883

    gcc/fortran/ChangeLog:

            * trans-array.cc (gfc_trans_deferred_array): Set length to zero,
            avoiding extraneous diagnostics.

    gcc/testsuite/ChangeLog:

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

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

* [Bug fortran/113883] allocatable length parameter used but is undefined
  2024-02-12  3:07 [Bug fortran/113883] New: allocatable length parameter used but is undefined kargl at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-02-13  4:51 ` cvs-commit at gcc dot gnu.org
@ 2024-02-13 17:20 ` sgk at troutmask dot apl.washington.edu
  4 siblings, 0 replies; 6+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2024-02-13 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Feb 13, 2024 at 04:51:02AM +0000, cvs-commit at gcc dot gnu.org wrote:
> The trunk branch has been updated by Jerry DeLisle <jvdelisle@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:6caec7d9ec37e60e718a12934c85bac9c12757ac
> 

Thanks, Jerry.

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

end of thread, other threads:[~2024-02-13 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12  3:07 [Bug fortran/113883] New: allocatable length parameter used but is undefined kargl at gcc dot gnu.org
2024-02-12  3:09 ` [Bug fortran/113883] " kargl at gcc dot gnu.org
2024-02-12  3:09 ` kargl at gcc dot gnu.org
2024-02-12 20:00 ` jvdelisle at gcc dot gnu.org
2024-02-13  4:51 ` cvs-commit at gcc dot gnu.org
2024-02-13 17:20 ` sgk at troutmask dot apl.washington.edu

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).