public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
@ 2010-12-11  9:47 ` tkoenig at gcc dot gnu.org
  2010-12-11 12:38 ` tkoenig at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-11  9:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-11 09:46:57 UTC ---
The error message is wrong if the

        if (substring)
            primary->ts.cl = NULL;

part is removed:

ig25@linux-fd1f:~/Krempel/Char> cat aa.f90
  character (len=4), pointer:: s1
  character (len=20), pointer :: p1
  s1 = 'abcd'
  p1 => s1(2:3)
end
ig25@linux-fd1f:~/Krempel/Char> gfortran aa.f90
aa.f90:4.2:

  p1 => s1(2:3)
  1
Fehler: Unequal character lengths (20/4) in pointer assignment at (1)

The length of the substring is wrongly taken to be 4, instead of 2.


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
  2010-12-11  9:47 ` [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match tkoenig at gcc dot gnu.org
@ 2010-12-11 12:38 ` tkoenig at gcc dot gnu.org
  2010-12-11 13:25 ` tkoenig at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-11 12:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-11 12:38:01 UTC ---
gfc_check_same_strlen does not check for references.

Ouch.


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
  2010-12-11  9:47 ` [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match tkoenig at gcc dot gnu.org
  2010-12-11 12:38 ` tkoenig at gcc dot gnu.org
@ 2010-12-11 13:25 ` tkoenig at gcc dot gnu.org
  2010-12-12 13:58 ` tkoenig at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-11 13:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-11 13:25:16 UTC ---
Working on a patch.


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-12-11 13:25 ` tkoenig at gcc dot gnu.org
@ 2010-12-12 13:58 ` tkoenig at gcc dot gnu.org
  2010-12-12 14:09 ` tkoenig at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-12 13:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-12 13:58:15 UTC ---
Created attachment 22724
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22724
patch which causes regressions


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2010-12-12 13:58 ` tkoenig at gcc dot gnu.org
@ 2010-12-12 14:09 ` tkoenig at gcc dot gnu.org
  2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-12 14:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-12 14:09:12 UTC ---
The patch in comment#7 causes a regression in

program gfcbug33
  character(12) :: a(2)
  a(1) = "abcdefghijkl"
  a(2) = "mnopqrstuvwx"
  call foo ((a(2:1:-1)(6:)))
contains
  subroutine foo (chr)
    character(7) :: chr(:)
    print *,'X',chr(1),'Y'
    print *,'A',chr(2),'B'
    if (chr(1)//chr(2) .ne. "rstuvwxfghijkl") call abort ()
  end subroutine foo
end program gfcbug33
ig25@linux-fd1f:~/Krempel/Char> gfortran short_1.f90
ig25@linux-fd1f:~/Krempel/Char> ./a.out
 XrstuvwxY
 A%�2�fgB
Abgebrochen

which is a shortened version of actual_array_substr_1.f90.

The part of the patch

-         if (substring)
-           primary->ts.u.cl = NULL;
-

opens a can of worms of wrong-code and rejects-valid bugs...


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2010-12-12 14:09 ` tkoenig at gcc dot gnu.org
@ 2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
  2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-13 20:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
@ 2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
  2010-12-21 22:11 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-13 20:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #22724|0                           |1
        is obsolete|                            |

--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-13 20:29:03 UTC ---
Created attachment 22746
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22746
As far as I got...

This is as far as I got.  Offsets are still calculated wrongly,
but without a clue as to where to start looking, I think I'll
give up for now.


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
@ 2010-12-21 22:11 ` tkoenig at gcc dot gnu.org
  2010-12-24  8:42 ` tkoenig at gcc dot gnu.org
  2010-12-24  8:44 ` tkoenig at gcc dot gnu.org
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-21 22:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #10 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-21 22:11:30 UTC ---
Created attachment 22838
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22838
Patch that has a good chance of working

(In reply to comment #8)
>
> The part of the patch
> 
> -         if (substring)
> -           primary->ts.u.cl = NULL;
> -
>

is part of the precipitate.  This should be better.


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2010-12-21 22:11 ` tkoenig at gcc dot gnu.org
@ 2010-12-24  8:42 ` tkoenig at gcc dot gnu.org
  2010-12-24  8:44 ` tkoenig at gcc dot gnu.org
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-24  8:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

--- Comment #11 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-24 08:42:07 UTC ---
Author: tkoenig
Date: Fri Dec 24 08:42:04 2010
New Revision: 168224

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168224
Log:
2010-12-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/31821
    * check.c (gfc_var_strlen):  New function, also including
    substring references.
    (gfc_check_same_strlen):  Use gfc_var_strlen.

2010-12-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/31821
    * gfortran.dg/char_pointer_assign_6.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/char_pointer_assign_6.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
       [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2010-12-24  8:42 ` tkoenig at gcc dot gnu.org
@ 2010-12-24  8:44 ` tkoenig at gcc dot gnu.org
  9 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2010-12-24  8:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #12 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2010-12-24 08:44:24 UTC ---
Fixed, closing.


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
  2007-05-04 19:11 [Bug fortran/31821] New: " burnus at gcc dot gnu dot org
  2007-05-04 19:43 ` [Bug fortran/31821] " jvdelisle at gcc dot gnu dot org
  2007-05-04 21:14 ` burnus at gcc dot gnu dot org
@ 2007-05-25  4:39 ` pault at gcc dot gnu dot org
  2 siblings, 0 replies; 13+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-05-25  4:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-05-25 05:38 -------
There seems to be a consensus on this - confirmed.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-25 05:38:53
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
  2007-05-04 19:11 [Bug fortran/31821] New: " burnus at gcc dot gnu dot org
  2007-05-04 19:43 ` [Bug fortran/31821] " jvdelisle at gcc dot gnu dot org
@ 2007-05-04 21:14 ` burnus at gcc dot gnu dot org
  2007-05-25  4:39 ` pault at gcc dot gnu dot org
  2 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-04 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-05-04 22:14 -------
See also: http://gcc.gnu.org/ml/fortran/2007-05/msg00072.html

One also needs a run-time test for:

    character (len=4), target :: s1
    character (len=2), pointer :: p1
    s1 = 'abcd'
    p1 => s1(1:2)
    if(s1 /= 'abcd') call abort()
    if(p1 /= 'ab')   call abort()
  end

There might be already such a check, though.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821


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

* [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match
  2007-05-04 19:11 [Bug fortran/31821] New: " burnus at gcc dot gnu dot org
@ 2007-05-04 19:43 ` jvdelisle at gcc dot gnu dot org
  2007-05-04 21:14 ` burnus at gcc dot gnu dot org
  2007-05-25  4:39 ` pault at gcc dot gnu dot org
  2 siblings, 0 replies; 13+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-04 19:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-05-04 20:43 -------
This looks suspiciously like the problem we are hunting down in pr31197.  Can
you have a look and see if its related, if not the same bug?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31821


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

end of thread, other threads:[~2010-12-24  8:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-31821-4@http.gcc.gnu.org/bugzilla/>
2010-12-11  9:47 ` [Bug fortran/31821] character pointer => target(range) should detect if lengths don't match tkoenig at gcc dot gnu.org
2010-12-11 12:38 ` tkoenig at gcc dot gnu.org
2010-12-11 13:25 ` tkoenig at gcc dot gnu.org
2010-12-12 13:58 ` tkoenig at gcc dot gnu.org
2010-12-12 14:09 ` tkoenig at gcc dot gnu.org
2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
2010-12-13 20:29 ` tkoenig at gcc dot gnu.org
2010-12-21 22:11 ` tkoenig at gcc dot gnu.org
2010-12-24  8:42 ` tkoenig at gcc dot gnu.org
2010-12-24  8:44 ` tkoenig at gcc dot gnu.org
2007-05-04 19:11 [Bug fortran/31821] New: " burnus at gcc dot gnu dot org
2007-05-04 19:43 ` [Bug fortran/31821] " jvdelisle at gcc dot gnu dot org
2007-05-04 21:14 ` burnus at gcc dot gnu dot org
2007-05-25  4:39 ` pault at gcc dot gnu dot 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).