* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
@ 2012-12-07 21:14 ` burnus at gcc dot gnu.org
2012-12-10 9:46 ` burnus at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-07 21:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-07 21:13:57 UTC ---
Created attachment 28898
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28898
Test case (still depends on the iso_varying_string module)
Slightly reduced test case - still needs the iso_varying_string module.
Compiling with 4.4/4.8 and 4.8/4.4 shows that the attached file miscompiled
while the big iso_varying_string module is correctly handled.
If one compares the dump between 4.4 and 4.8 for the second (the array) SPLIT
call, one finds for 4.4 and 4.8, respectively:
split_ch (&strar[S.14 + D.1624], &wrdar[S.14 + D.1625], D.1621, &separ[S.14 +
D.1626], 0B, MAX_EXPR <D.1616, 0>);
split_ch (&strar[S.14 + D.1624], &wrdar[S.14 + D.1625], &D.1621, &separ[S.14 +
D.1626], 0B, MAX_EXPR <D.1616, 0>);
Note the "&" before D.1621. The latter is:
character(kind=1)[1:MAX_EXPR <D.1616, 0>] * pstr.12;
D.1964 = &set;
D.1619 = __builtin_malloc (....)
char_auto (pstr.12, MAX_EXPR <D.1616, 0>, D.1964);
pstr.12 = (character(kind=1)[1:MAX_EXPR <D.1616, 0>] *) D.1619;
The called function is defined as:
elemental subroutine split_CH (string, word, set, separator, back)
type(varying_string), intent(inout) :: string
type(varying_string), intent(out) :: word
character(LEN=*), intent(in) :: set
type(varying_string), intent(out), optional :: separator
logical, intent(in), optional :: back
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
2012-12-07 21:14 ` [Bug fortran/55618] " burnus at gcc dot gnu.org
@ 2012-12-10 9:46 ` burnus at gcc dot gnu.org
2012-12-10 11:43 ` burnus at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-10 9:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-10 09:45:45 UTC ---
Reduced test case:
module m
implicit none
type t
character :: str(11)
end type t
interface char
module procedure char_auto
end interface char
contains
pure function char_auto (string) result (char_string)
type(t), intent(in) :: string
character(LEN=size(string%str)) :: char_string
integer :: i_char
forall(i_char = 1:size(string%str))
char_string(i_char:i_char) = string%str(i_char)
end forall
end function char_auto
elemental subroutine split_CH (string, set)
type(t), intent(inout) :: string
character(LEN=*), intent(in) :: set
integer :: i
do i = 1, min(len(set),size(string%str))
string%str(i) = set(i:i)
end do
end subroutine split_CH
end module m
use m
type(t) :: mdt, mdt2(2),setdt
mdt%str = ['H', 'e', 'l', 'l', 'o', ' ', 'W','o', 'r', 'l', 'd']
mdt2 = [ mdt, mdt ]
setdt%str = ['F', 'o', 'r', 't', 'r', 'a', 'n','R', 'u', 'l', 'z']
call split_CH(mdt2, char(setdt))
print '(11a)', mdt2(1)%str
print '(11a)', mdt2(2)%str
if (any (mdt2(1)%str /= setdt%str)) call abort ()
if (any (mdt2(2)%str /= setdt%str)) call abort ()
end
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
2012-12-07 21:14 ` [Bug fortran/55618] " burnus at gcc dot gnu.org
2012-12-10 9:46 ` burnus at gcc dot gnu.org
@ 2012-12-10 11:43 ` burnus at gcc dot gnu.org
2013-01-06 18:48 ` pault at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-12-10 11:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Target Milestone|--- |4.6.4
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-12-10 11:43:34 UTC ---
In trans-expr.c's gfc_conv_procedure_call, one calls:
3997 else if (se->ss && se->ss->info->useflags)
3998 {
...
4007 if (ss->dimen > 0 && e->expr_type == EXPR_VARIABLE
4008 && ss->info->data.array.ref == NULL)
...
4016 else
4017 gfc_conv_expr_reference (&parmse, e);
* * *
Even shorter example. Note the VALUE attribute (cf. PR55638 for the wrong
"INTENT(IN)"):
integer :: A(3)
call foo(a, f())
print *, a
contains
elemental subroutine foo(x,y)
integer, intent(inout) :: x
integer, VALUE, intent(in) :: y
x = y
end subroutine foo
function f()
integer :: f
f = 42
end function f
end
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (2 preceding siblings ...)
2012-12-10 11:43 ` burnus at gcc dot gnu.org
@ 2013-01-06 18:48 ` pault at gcc dot gnu.org
2013-01-06 21:12 ` pault at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2013-01-06 18:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-06 18:48:07 UTC ---
Created attachment 29089
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29089
modified version of one of the failing tests
Confirmed
This is a failure of the scalarizer, which is why I have bumped up its
importance.
The final invocation of SPLIT, from within a scalarizer loop, is passing the
character argument CHAR(set) as a pointer to a pointer.
Replacing this call with one to a contained function foo (see attachment),
results in success for 'choice' 0 or 2 (explicit loop or passing VST, rather
than character)
subroutine foo (choice)
integer :: choice
if (choice == 1) then
CALL SPLIT(strar,wrdar,CHAR(set),separ)
else if (choice == 2) then
CALL SPLIT(strar,wrdar,set,separ)
else
DO i=1,ndim
DO j=1,ndim
CALL SPLIT(strar(i,j),wrdar(i,j),CHAR(set),separ(i,j))
end do
end do
end if
end subroutine
The code produced by this appears below and is the reason for my assertion that
this is a scalarizer problem. I suspect from inspection that VST30/31 fail for
the same reason.
I have added Mikael in copy, hoping that his more recent exposure to the
scalarizer will help identify the root cause more quickly.
Cheers
Paul
foo (integer(kind=4) & restrict choice)
{
if (*choice == 1)
{
{
character(kind=1)[1:MAX_EXPR <D.2015, 0>] * D.2020;
void * restrict D.2018;
integer(kind=4) D.2017;
character(kind=1)[1:MAX_EXPR <D.2015, 0>] * pstr.26;
integer(kind=4) D.2015;
struct varying_string * D.2014;
D.2014 = &set;
D.2015 = len_ (D.2014);
D.2017 = MAX_EXPR <D.2015, 0> * 64;
D.2018 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long)
D.2017, 1>);
pstr.26 = (character(kind=1)[1:MAX_EXPR <D.2015, 0>] *) D.2018;
char_auto (pstr.26, MAX_EXPR <D.2015, 0>, D.2014);
D.2020 = pstr.26;
{
integer(kind=8) S.27;
S.27 = 1;
while (1)
{
if (S.27 > 2) goto L.10;
{
integer(kind=8) D.2025;
integer(kind=8) D.2024;
integer(kind=8) D.2023;
integer(kind=8) S.28;
D.2023 = S.27 * 2 + -3;
D.2024 = S.27 * 2 + -3;
D.2025 = S.27 * 2 + -3;
S.28 = 1;
while (1)
{
if (S.28 > 2) goto L.9;
split_ch (&strar[S.28 + D.2023], &wrdar[S.28 + D.2024],
&D.2020, &separ[S.28 + D.2025], 0B, MAX_EXPR <D.2015, 0>);
S.28 = S.28 + 1;
}
L.9:;
}
S.27 = S.27 + 1;
}
L.10:;
}
{
void * D.2019;
D.2019 = (void *) pstr.26;
if (D.2019 != 0B)
{
__builtin_free (D.2019);
}
}
}
}
else
{
if (*choice == 2)
{
{
struct varying_string D.2029;
D.2029 = set;
{
integer(kind=8) S.29;
S.29 = 1;
while (1)
{
if (S.29 > 2) goto L.12;
{
integer(kind=8) D.2034;
integer(kind=8) D.2033;
integer(kind=8) D.2032;
integer(kind=8) S.30;
D.2032 = S.29 * 2 + -3;
D.2033 = S.29 * 2 + -3;
D.2034 = S.29 * 2 + -3;
S.30 = 1;
while (1)
{
if (S.30 > 2) goto L.11;
split_vs (&strar[S.30 + D.2032], &wrdar[S.30 + D.2033],
&D.2029, &separ[S.30 + D.2034], 0B);
S.30 = S.30 + 1;
}
L.11:;
}
S.29 = S.29 + 1;
}
L.12:;
}
}
}
else
{
i = 1;
if (i <= 2)
{
while (1)
{
{
logical(kind=4) D.2049;
j = 1;
if (j <= 2)
{
while (1)
{
{
logical(kind=4) D.2048;
{
void * restrict D.2046;
integer(kind=4) D.2045;
character(kind=1)[1:MAX_EXPR <D.2043, 0>] *
pstr.31;
integer(kind=4) D.2043;
struct varying_string * D.2042;
D.2042 = &set;
D.2043 = len_ (D.2042);
D.2045 = MAX_EXPR <D.2043, 0> * 64;
D.2046 = (void * restrict) __builtin_malloc
(MAX_EXPR <(unsigned long) D.2045, 1>);
pstr.31 = (character(kind=1)[1:MAX_EXPR
<D.2043, 0>] *) D.2046;
char_auto (pstr.31, MAX_EXPR <D.2043, 0>,
D.2042);
split_ch (&strar[((integer(kind=8)) j * 2 +
(integer(kind=8)) i) + -3], &wrdar[((integer(kind=8)) j * 2 + (integer(kind=8))
i) + -3], pstr.31, &separ[((integer(kind=8)) j * 2 + (integer(kind=8)) i) +
-3], 0B, MAX_EXPR <D.2043, 0>);
{
void * D.2047;
D.2047 = (void *) pstr.31;
if (D.2047 != 0B)
{
__builtin_free (D.2047);
}
}
}
L.15:;
D.2048 = j == 2;
j = j + 1;
if (D.2048) goto L.16;
}
}
}
L.16:;
L.13:;
D.2049 = i == 2;
i = i + 1;
if (D.2049) goto L.14;
}
}
}
L.14:;
}
}
L.8:;
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (3 preceding siblings ...)
2013-01-06 18:48 ` pault at gcc dot gnu.org
@ 2013-01-06 21:12 ` pault at gcc dot gnu.org
2013-01-07 23:42 ` dominiq at lps dot ens.fr
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2013-01-06 21:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-06
AssignedTo|unassigned at gcc dot |pault at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #5 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-06 21:12:31 UTC ---
Created attachment 29091
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29091
Tentative patch for the PR
This appears to do the job. It fixes all the iso_varying_string failures and
regtests.
I will have to develop a suitable testcase, check all the side wrinkles and
find out where the bug was introduced. Should be able to submit tomorrow
night.
Paul
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (4 preceding siblings ...)
2013-01-06 21:12 ` pault at gcc dot gnu.org
@ 2013-01-07 23:42 ` dominiq at lps dot ens.fr
2013-01-08 6:14 ` pault at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-01-07 23:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-07 23:41:41 UTC ---
The code in comment #2 is correctly compiled by revision 158253 (2010-04-13),
but it is not by revision 159105 (2010-05-06).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (5 preceding siblings ...)
2013-01-07 23:42 ` dominiq at lps dot ens.fr
@ 2013-01-08 6:14 ` pault at gcc dot gnu.org
2013-01-13 7:51 ` [Bug fortran/55618] [4.6/4.7 " pault at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2013-01-08 6:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-08 06:14:01 UTC ---
Author: pault
Date: Tue Jan 8 06:13:52 2013
New Revision: 195004
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195004
Log:
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* trans-expr.c (gfc_conv_procedure_call): Dereference scalar
character function arguments to elemental procedures in
scalarization loops.
2013-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* gfortran.dg/elemental_scalar_args_2.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/elemental_scalar_args_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6/4.7 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (6 preceding siblings ...)
2013-01-08 6:14 ` pault at gcc dot gnu.org
@ 2013-01-13 7:51 ` pault at gcc dot gnu.org
2013-01-14 17:59 ` [Bug fortran/55618] [4.6 " pault at gcc dot gnu.org
2013-01-14 18:45 ` [Bug fortran/55618] [4.6, 4.7, 4.8 " pault at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2013-01-13 7:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
--- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-13 07:51:30 UTC ---
Author: pault
Date: Sun Jan 13 07:51:26 2013
New Revision: 195129
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195129
Log:
2013-01-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* trans-expr.c (gfc_conv_procedure_call): Dereference scalar
character function arguments to elemental procedures in
scalarization loops.
2013-01-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* gfortran.dg/elemental_scalar_args_2.f90: New test.
Added:
branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/elemental_scalar_args_2.f90
Modified:
branches/gcc-4_7-branch/gcc/fortran/ChangeLog
branches/gcc-4_7-branch/gcc/fortran/resolve.c
branches/gcc-4_7-branch/gcc/fortran/trans-expr.c
branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (7 preceding siblings ...)
2013-01-13 7:51 ` [Bug fortran/55618] [4.6/4.7 " pault at gcc dot gnu.org
@ 2013-01-14 17:59 ` pault at gcc dot gnu.org
2013-01-14 18:45 ` [Bug fortran/55618] [4.6, 4.7, 4.8 " pault at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2013-01-14 17:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-14 17:59:13 UTC ---
Author: pault
Date: Mon Jan 14 17:59:07 2013
New Revision: 195159
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195159
Log:
2013-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* trans-expr.c (gfc_conv_procedure_call): Dereference scalar
character function arguments to elemental procedures in
scalarization loops.
2013-01-14 Paul Thomas <pault@gcc.gnu.org>
PR fortran/55618
* gfortran.dg/elemental_scalar_args_2.f90: New test.
Added:
branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/elemental_scalar_args_2.f90
Modified:
branches/gcc-4_6-branch/gcc/fortran/ChangeLog
branches/gcc-4_6-branch/gcc/fortran/trans-expr.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/55618] [4.6, 4.7, 4.8 Regression] Failures with ISO_Varying_String test suite
2012-12-07 19:14 [Bug fortran/55618] New: [4.6/4.7/4.8 Regression] Failures with ISO_Varying_String test suite burnus at gcc dot gnu.org
` (8 preceding siblings ...)
2013-01-14 17:59 ` [Bug fortran/55618] [4.6 " pault at gcc dot gnu.org
@ 2013-01-14 18:45 ` pault at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: pault at gcc dot gnu.org @ 2013-01-14 18:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55618
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Summary|[4.6 Regression] Failures |[4.6, 4.7, 4.8 Regression]
|with ISO_Varying_String |Failures with
|test suite |ISO_Varying_String test
| |suite
--- Comment #10 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-14 18:44:42 UTC ---
Fixed on 4.6, 4.7 and 4.8 - thanks for the report.
Paul
^ permalink raw reply [flat|nested] 11+ messages in thread