public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time
@ 2007-08-30 21:48 burnus at gcc dot gnu dot org
2007-08-31 6:08 ` [Bug fortran/33254] " burnus at gcc dot gnu dot org
` (18 more replies)
0 siblings, 19 replies; 20+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-30 21:48 UTC (permalink / raw)
To: gcc-bugs
The following program is invalid Fortran 95/2003, but this cannot be diagnosed
at compile time:
program array_char
implicit none
character (len=2) :: x, y
x = "a "
y = "cd"
print*,[trim(x),trim(y)] ! [ "a", "cd" ] ->INVALID: different string lengths
end program array_char
While behavior of gfortran is ok (ifort, sunf95 and openf95 do the same), it
would be great if using, e.g., -fbounds-check an error would be printed:
NAG f95 prints for that program (at run time):
Unequal character lengths (2 and 1) in array constructor
and g95:
Fortran runtime error: Inconsistent string size in array constructor
--
Summary: Diagnose different string lengths in array constructors
at run time
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
@ 2007-08-31 6:08 ` burnus at gcc dot gnu dot org
2007-08-31 6:16 ` burnus at gcc dot gnu dot org
` (17 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-31 6:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-08-31 06:08 -------
See also PR 32703; example found by Paul and compared with other compilers by
Dominique and me.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |27766
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
2007-08-31 6:08 ` [Bug fortran/33254] " burnus at gcc dot gnu dot org
@ 2007-08-31 6:16 ` burnus at gcc dot gnu dot org
2007-08-31 8:17 ` pault at gcc dot gnu dot org
` (16 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-31 6:16 UTC (permalink / raw)
To: gcc-bugs
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
2007-08-31 6:08 ` [Bug fortran/33254] " burnus at gcc dot gnu dot org
2007-08-31 6:16 ` burnus at gcc dot gnu dot org
@ 2007-08-31 8:17 ` pault at gcc dot gnu dot org
2007-10-10 13:00 ` tobi at gcc dot gnu dot org
` (15 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-08-31 8:17 UTC (permalink / raw)
To: gcc-bugs
--
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-08-31 08:16:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-08-31 8:17 ` pault at gcc dot gnu dot org
@ 2007-10-10 13:00 ` tobi at gcc dot gnu dot org
2007-10-10 14:23 ` tobi at gcc dot gnu dot org
` (14 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-10 13:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tobi at gcc dot gnu dot org 2007-10-10 12:59 -------
I have a patch for this. Unfortunately, while playing around with testcases I
found a new segfault, so I'll have to look into this before submitting.
Failing testcase:
! { dg-do run }
! { dg-options "-fbounds-check" }
! { dg-shouldfail "Different CHARACTER lengths" }
! PR fortran/33254: No bounds checking for array constructors
program array_char
implicit none
character (len=2) :: x, y
character (len=2) :: z(2)
x = "a "
y = "cd"
z = [y(1:len(trim(y))), x(1:1)] ! causes segfault
z = [trim(x),trim(y)] ! [ "a", "cd" ] ->INVALID: different string lengths
end program array_char
! { dg-output "Different CHARACTER lengths .2/1. in array constructor" }
! { dg-output "Different CHARACTER lengths .1/2. in array constructor" }
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |tobi at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-08-31 08:16:55 |2007-10-10 12:59:49
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-10-10 13:00 ` tobi at gcc dot gnu dot org
@ 2007-10-10 14:23 ` tobi at gcc dot gnu dot org
2007-10-11 7:30 ` pault at gcc dot gnu dot org
` (13 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-10 14:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from tobi at gcc dot gnu dot org 2007-10-10 14:23 -------
The failure from #2 is now PR 33727.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-10-10 14:23 ` tobi at gcc dot gnu dot org
@ 2007-10-11 7:30 ` pault at gcc dot gnu dot org
2007-10-11 9:38 ` dominiq at lps dot ens dot fr
` (12 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-11 7:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pault at gcc dot gnu dot org 2007-10-11 07:29 -------
(In reply to comment #3)
> The failure from #2 is now PR 33727.
Tobi,
Why don't you fix them both at once? :-)
Cheers
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-10-11 7:30 ` pault at gcc dot gnu dot org
@ 2007-10-11 9:38 ` dominiq at lps dot ens dot fr
2007-10-11 10:45 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
` (11 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-11 9:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dominiq at lps dot ens dot fr 2007-10-11 09:38 -------
After applying the patch and the one to PR33727 (thanks Paul!-), the first test
fails at runtime:
At line 6 of file pr32703_1.f90
Fortran runtime error: Different CHARACTER lengths (1/2) in array constructor
but the following code
program array_char
implicit none
character (len=2) :: x, y
character (len=2) :: z(2)
x = "a "
y = "cd"
z = (/y(1:len(trim(y))), x(1:len(trim(x)))/) ! causes segfault
print *, "'", z(1), "' '", z(2), "'"
end program array_char
gives
[karma] f90/bug% gfc -fbounds-check pr33727_bad.f90
[karma] f90/bug% a.out
'cd' 'a'
I am expecting this test to fail at runtime and the other one. Am I missing
something.
I have also noticed something strange with the following valid(?) code:
program array_char
implicit none
character (len=2) :: x, y
character (len=2) :: z(2)
x = "a "
y = "cd"
z = " "
z = (/y(1:len(trim(x))), x(1:len(trim(x)))/)
print *, "'", z(1), "' '", z(2), "'"
end program array_char
which gives
'c' 'a'
while I am expecting
'c ' 'a '
Looks like another bug, should I fill a new PR?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-10-11 9:38 ` dominiq at lps dot ens dot fr
@ 2007-10-11 10:45 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-11 12:35 ` dominiq at lps dot ens dot fr
` (10 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Tobias dot Schlueter at physik dot uni-muenchen dot de @ 2007-10-11 10:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from Tobias dot Schlueter at physik dot uni-muenchen dot de 2007-10-11 10:45 -------
Subject: Re: Diagnose different string lengths in array
constructors at run time
dominiq at lps dot ens dot fr wrote:
> program array_char
> implicit none
> character (len=2) :: x, y
> character (len=2) :: z(2)
> x = "a "
> y = "cd"
> z = (/y(1:len(trim(y))), x(1:len(trim(x)))/) ! causes segfault
> print *, "'", z(1), "' '", z(2), "'"
> end program array_char
>
> gives
>
> [karma] f90/bug% gfc -fbounds-check pr33727_bad.f90
> [karma] f90/bug% a.out
> 'cd' 'a'
>
> I am expecting this test to fail at runtime and the other one. Am I missing
> something.
This is weird, and can't really be (well, in a hypothetical world where
only the bounds check goes wrong), as the whole array has only a single
string length, so I would expect it to either print two length one
strings or two length two strings, not one lenghth one string and one
length two string.
>
> I have also noticed something strange with the following valid(?) code:
>
> program array_char
> implicit none
> character (len=2) :: x, y
> character (len=2) :: z(2)
> x = "a "
> y = "cd"
> z = " "
> z = (/y(1:len(trim(x))), x(1:len(trim(x)))/)
> print *, "'", z(1), "' '", z(2), "'"
> end program array_char
>
> which gives
>
> 'c' 'a'
>
> while I am expecting
>
> 'c ' 'a '
>
> Looks like another bug, should I fill a new PR?
Yes. This looks related to the previous one, again the string length
seems to be taken from the wrong place.
Are these with or without Paul's patch?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-10-11 10:45 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
@ 2007-10-11 12:35 ` dominiq at lps dot ens dot fr
2007-10-11 14:04 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
` (9 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-11 12:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from dominiq at lps dot ens dot fr 2007-10-11 12:34 -------
> This is weird, and can't really be (well, in a hypothetical world where
> only the bounds check goes wrong), as the whole array has only a single
> string length, so I would expect it to either print two length one
> strings or two length two strings, not one lenghth one string and one
> length two string.
I am not sure to understand the above. Each element of z is a string of length
2,
y(1:len(trim(y))) is also of length 2, while x(1:len(trim(x))) is of length
one,
so the constructor should give an error.
> Are these with or without Paul's patch?
with otherwise I got an ICE.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-10-11 12:35 ` dominiq at lps dot ens dot fr
@ 2007-10-11 14:04 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-11 14:09 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
` (8 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Tobias dot Schlueter at physik dot uni-muenchen dot de @ 2007-10-11 14:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from Tobias dot Schlueter at physik dot uni-muenchen dot de 2007-10-11 14:04 -------
Subject: Re: Diagnose different string lengths in array
constructors at run time
dominiq at lps dot ens dot fr wrote:
> ------- Comment #7 from dominiq at lps dot ens dot fr 2007-10-11 12:34 -------
>> This is weird, and can't really be (well, in a hypothetical world where
>> only the bounds check goes wrong), as the whole array has only a single
>> string length, so I would expect it to either print two length one
>> strings or two length two strings, not one lenghth one string and one
>> length two string.
>
> I am not sure to understand the above. Each element of z is a string of length
> 2,
> y(1:len(trim(y))) is also of length 2, while x(1:len(trim(x))) is of length
> one,
> so the constructor should give an error.
Yes, I agree with the latter. What I menat is the following: after the
data has been added to the array, the compiler should use the string
length of the array, so if you do
CHARACTER*10 z
z = (/ something /)
print *, z
all printed strings should be length 10, no the contents of the constructor.
>> Are these with or without Paul's patch?
>
> with otherwise I got an ICE.
ok, thanks.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (9 preceding siblings ...)
2007-10-11 14:04 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
@ 2007-10-11 14:09 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-11 14:10 ` dominiq at lps dot ens dot fr
` (7 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Tobias dot Schlueter at physik dot uni-muenchen dot de @ 2007-10-11 14:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from Tobias dot Schlueter at physik dot uni-muenchen dot de 2007-10-11 14:09 -------
Subject: Re: Diagnose different string lengths in array
constructors at run time
Tobias dot Schlueter at physik dot uni-muenchen dot de wrote:
> all printed strings should be length 10, no the contents of the constructor.
^^ read: independent of
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (10 preceding siblings ...)
2007-10-11 14:09 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
@ 2007-10-11 14:10 ` dominiq at lps dot ens dot fr
2007-10-11 14:15 ` tobi at gcc dot gnu dot org
` (6 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-11 14:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from dominiq at lps dot ens dot fr 2007-10-11 14:10 -------
> ... What I menat is the following: after the
> data has been added to the array, the compiler should use the string
> length of the array, ...
I agree, this is why I posted the second code with y(1:len(trim(x))),
because the result seems wrong to me. My question was "is this related to this
PR or a different one?" If the answer is yes to the latter, then we probably
need to open a new PR.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (11 preceding siblings ...)
2007-10-11 14:10 ` dominiq at lps dot ens dot fr
@ 2007-10-11 14:15 ` tobi at gcc dot gnu dot org
2007-10-13 21:44 ` tobi at gcc dot gnu dot org
` (5 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-11 14:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from tobi at gcc dot gnu dot org 2007-10-11 14:14 -------
I'm adding Paul to the CC list, as perhaps he immediately knows what's
happening (Paul, see comment #5). Otherwise I will investigate tomorrow
evening or Saturday.
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (12 preceding siblings ...)
2007-10-11 14:15 ` tobi at gcc dot gnu dot org
@ 2007-10-13 21:44 ` tobi at gcc dot gnu dot org
2007-10-13 21:47 ` tobi at gcc dot gnu dot org
` (4 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-13 21:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from tobi at gcc dot gnu dot org 2007-10-13 21:44 -------
Subject: Bug 33254
Author: tobi
Date: Sat Oct 13 21:43:49 2007
New Revision: 129286
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129286
Log:
2007-10-13 Tobias Schlueter <tobi@gcc.gnu.org>
Paul Thomas <pault@gcc.gnu.org>
PR fortran/33254
PR fortran/33727
fortran/
* trans-array.c (get_array_ctor_var_strlen): Check upper bound for
constness instead of lower bound.
(get_array_ctor_strlen): Add bounds-checking code.
testsuite/
* bounds_check_10.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/bounds_check_10.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (13 preceding siblings ...)
2007-10-13 21:44 ` tobi at gcc dot gnu dot org
@ 2007-10-13 21:47 ` tobi at gcc dot gnu dot org
2007-10-21 20:05 ` dominiq at lps dot ens dot fr
` (3 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-13 21:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from tobi at gcc dot gnu dot org 2007-10-13 21:47 -------
Fixed.
--
tobi at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (14 preceding siblings ...)
2007-10-13 21:47 ` tobi at gcc dot gnu dot org
@ 2007-10-21 20:05 ` dominiq at lps dot ens dot fr
2007-10-21 20:13 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
` (2 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-21 20:05 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 893 bytes --]
------- Comment #14 from dominiq at lps dot ens dot fr 2007-10-21 20:05 -------
Now I understand the strange result I reported in comment #5. What is happening
is that there is a second nonprintable character. If I redirect the output to a
file I see it (in general ^@).
>From what I understand of the code the substring x(1:len(trim(x))) is not
computed correctly by:
if (ref->u.ss.start->expr_type != EXPR_CONSTANT
|| ref->u.ss.end->expr_type != EXPR_CONSTANT)
break;
probably not computed at all, as noticed by Tobias Schlüter in the patch in
http://gcc.gnu.org/ml/fortran/2007-10/msg00212.html
However get_array_ctor_all_strlen (block, expr, len); leads to ICE's. I assume
that there is somewhere a piece of code able to compute the length of
x(1:len(trim(x))), but I did not find it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (15 preceding siblings ...)
2007-10-21 20:05 ` dominiq at lps dot ens dot fr
@ 2007-10-21 20:13 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-21 21:18 ` tobi at gcc dot gnu dot org
2007-10-23 6:20 ` pault at gcc dot gnu dot org
18 siblings, 0 replies; 20+ messages in thread
From: Tobias dot Schlueter at physik dot uni-muenchen dot de @ 2007-10-21 20:13 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]
------- Comment #15 from Tobias dot Schlueter at physik dot uni-muenchen dot de 2007-10-21 20:13 -------
Subject: Re: Diagnose different string lengths in array
constructors at run time
dominiq at lps dot ens dot fr wrote:
> ------- Comment #14 from dominiq at lps dot ens dot fr 2007-10-21 20:05 -------
> Now I understand the strange result I reported in comment #5. What is happening
> is that there is a second nonprintable character. If I redirect the output to a
> file I see it (in general ^@).
>
> From what I understand of the code the substring x(1:len(trim(x))) is not
> computed correctly by:
>
> if (ref->u.ss.start->expr_type != EXPR_CONSTANT
> || ref->u.ss.end->expr_type != EXPR_CONSTANT)
> break;
>
> probably not computed at all, as noticed by Tobias Schlüter in the patch in
>
> http://gcc.gnu.org/ml/fortran/2007-10/msg00212.html
The next iteration of the testcase will contain code that verifies that
the string length actually gets calculated :-}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (16 preceding siblings ...)
2007-10-21 20:13 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
@ 2007-10-21 21:18 ` tobi at gcc dot gnu dot org
2007-10-23 6:20 ` pault at gcc dot gnu dot org
18 siblings, 0 replies; 20+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-10-21 21:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from tobi at gcc dot gnu dot org 2007-10-21 21:18 -------
Re this testcase:
(In reply to comment #5)
> program array_char
> implicit none
> character (len=2) :: x, y
> character (len=2) :: z(2)
> x = "a "
> y = "cd"
> z = (/y(1:len(trim(y))), x(1:len(trim(x)))/) ! causes segfault
> print *, "'", z(1), "' '", z(2), "'"
> end program array_char
Changing z's length to, say, 5 shows that the strings are correctly padded,
i.e. z(1) == "cd " after the assignment, so there's only an issue with
bounds-checking not working on this code, it doesn't expose another bug. I've
yet to figure out how to evaluate the string length, and only evaluate it once.
Dominique has correctly identified one of the crucial parts of the code in
#14. I hope I can look at this tomorrow night or Wednesday night.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Bug fortran/33254] Diagnose different string lengths in array constructors at run time
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
` (17 preceding siblings ...)
2007-10-21 21:18 ` tobi at gcc dot gnu dot org
@ 2007-10-23 6:20 ` pault at gcc dot gnu dot org
18 siblings, 0 replies; 20+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-23 6:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from pault at gcc dot gnu dot org 2007-10-23 06:19 -------
(In reply to comment #11)
> I'm adding Paul to the CC list, as perhaps he immediately knows what's
> happening (Paul, see comment #5). Otherwise I will investigate tomorrow
> evening or Saturday.
I'm pretty permanently on the road, at the moment, so I missed this. I'll try
to take a look-see tonight, although I am trying to concentrate on getting the
various FORALL bugs sorted.
Cheers
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33254
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2007-10-23 6:20 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-30 21:48 [Bug fortran/33254] New: Diagnose different string lengths in array constructors at run time burnus at gcc dot gnu dot org
2007-08-31 6:08 ` [Bug fortran/33254] " burnus at gcc dot gnu dot org
2007-08-31 6:16 ` burnus at gcc dot gnu dot org
2007-08-31 8:17 ` pault at gcc dot gnu dot org
2007-10-10 13:00 ` tobi at gcc dot gnu dot org
2007-10-10 14:23 ` tobi at gcc dot gnu dot org
2007-10-11 7:30 ` pault at gcc dot gnu dot org
2007-10-11 9:38 ` dominiq at lps dot ens dot fr
2007-10-11 10:45 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-11 12:35 ` dominiq at lps dot ens dot fr
2007-10-11 14:04 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-11 14:09 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-11 14:10 ` dominiq at lps dot ens dot fr
2007-10-11 14:15 ` tobi at gcc dot gnu dot org
2007-10-13 21:44 ` tobi at gcc dot gnu dot org
2007-10-13 21:47 ` tobi at gcc dot gnu dot org
2007-10-21 20:05 ` dominiq at lps dot ens dot fr
2007-10-21 20:13 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-10-21 21:18 ` tobi at gcc dot gnu dot org
2007-10-23 6:20 ` 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).