* [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; 14+ 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] 14+ 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 ` 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; 14+ 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] 14+ 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 ` 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ 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; 14+ 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] 14+ messages in thread