public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string
@ 2014-11-30  9:29 fxcoudert at gcc dot gnu.org
  2014-11-30  9:30 ` [Bug fortran/64120] " fxcoudert at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-30  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64120
           Summary: [F03] Wrong handling of allocatable character string
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org

The following code shows allocatable character does not work as it should:

   call g(1)
contains
  subroutine g(x)
      integer :: x
      character(len=x), allocatable :: s
      allocate(s)
      write(*,*) x, len(s)
  end subroutine
end


It should output "1 1" but outputs "1 0". The tree dump shows that the argument
x is never used in the string allocation.


A longer testcase, including SAVE (which seems also mishandled, but it is
probably linked to this issue):

program test
   logical :: L
   L = g(1)
   write(*,*) L
   L = g(2)
   write(*,*) L
contains
  logical function g(x)
      integer :: x
      character(len=x), allocatable :: s
      save
      if(.NOT.allocated(s)) then
        allocate(s)
        g = .FALSE.
      else
        g = .TRUE.
      end if
      write(*,*) len(s)
  end function g
end


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

* [Bug fortran/64120] [F03] Wrong handling of allocatable character string
  2014-11-30  9:29 [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string fxcoudert at gcc dot gnu.org
@ 2014-11-30  9:30 ` fxcoudert at gcc dot gnu.org
  2014-11-30 11:44 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2014-11-30  9:30 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-30
     Ever confirmed|0                           |1


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

* [Bug fortran/64120] [F03] Wrong handling of allocatable character string
  2014-11-30  9:29 [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string fxcoudert at gcc dot gnu.org
  2014-11-30  9:30 ` [Bug fortran/64120] " fxcoudert at gcc dot gnu.org
@ 2014-11-30 11:44 ` dominiq at lps dot ens.fr
  2014-11-30 17:28 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-11-30 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

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

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Already present in 4.5.4. With 4.4.7 I get

      character(len=x), allocatable :: s
                                        1
Error: Scalar object 's' at (1) may not be ALLOCATABLE


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

* [Bug fortran/64120] [F03] Wrong handling of allocatable character string
  2014-11-30  9:29 [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string fxcoudert at gcc dot gnu.org
  2014-11-30  9:30 ` [Bug fortran/64120] " fxcoudert at gcc dot gnu.org
  2014-11-30 11:44 ` dominiq at lps dot ens.fr
@ 2014-11-30 17:28 ` kargl at gcc dot gnu.org
  2014-11-30 17:44 ` dominiq at lps dot ens.fr
  2020-07-13 21:27 ` dominiq at lps dot ens.fr
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2014-11-30 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

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

--- Comment #2 from kargl at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #1)
> Already present in 4.5.4. With 4.4.7 I get
> 
>       character(len=x), allocatable :: s
>                                         1
> Error: Scalar object 's' at (1) may not be ALLOCATABLE

Of course you'll get errors with 4.5.4 and 4.4.7.  Support
for deferred parameter type was added in 4.6.

-- 
steve


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

* [Bug fortran/64120] [F03] Wrong handling of allocatable character string
  2014-11-30  9:29 [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string fxcoudert at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-11-30 17:28 ` kargl at gcc dot gnu.org
@ 2014-11-30 17:44 ` dominiq at lps dot ens.fr
  2020-07-13 21:27 ` dominiq at lps dot ens.fr
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-11-30 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Of course you'll get errors with 4.5.4 and 4.4.7.  Support
> for deferred parameter type was added in 4.6.

If I am not mistaken, the problem with this PR is allocatable scalars and not
deferred parameter type. The tests compile without error with 4.5.4.


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

* [Bug fortran/64120] [F03] Wrong handling of allocatable character string
  2014-11-30  9:29 [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string fxcoudert at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-11-30 17:44 ` dominiq at lps dot ens.fr
@ 2020-07-13 21:27 ` dominiq at lps dot ens.fr
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-13 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

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

end of thread, other threads:[~2020-07-13 21:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-30  9:29 [Bug fortran/64120] New: [F03] Wrong handling of allocatable character string fxcoudert at gcc dot gnu.org
2014-11-30  9:30 ` [Bug fortran/64120] " fxcoudert at gcc dot gnu.org
2014-11-30 11:44 ` dominiq at lps dot ens.fr
2014-11-30 17:28 ` kargl at gcc dot gnu.org
2014-11-30 17:44 ` dominiq at lps dot ens.fr
2020-07-13 21:27 ` dominiq at lps dot ens.fr

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