public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers
@ 2006-08-31 1:45 kornkven at arsc dot edu
2006-08-31 2:06 ` [Bug fortran/28914] " kargl at gcc dot gnu dot org
` (14 more replies)
0 siblings, 15 replies; 16+ messages in thread
From: kornkven at arsc dot edu @ 2006-08-31 1:45 UTC (permalink / raw)
To: gcc-bugs
!
! Un-comment the DO and ENDDO and the compiled program
! hangs after the first output line.
!
! Compiled with: gfortran junk.f90
! where: gfortran --version gives
! GNU Fortran 95 (GCC 4.0.2 20051125 (Red Hat 4.0.2-8))
! Running on Fedora Core 4, Opteron
!
! E. Kornkven, kornkven@arsc.edu
!
program junk
implicit none
integer n, i
parameter (n = 1000000)
double precision a(n), b(n), c(n), summation
print*, ' perform some computation ... '
summation = 0.0
do i = 1, 1
a = (/ (i, i = 1, n) /)
a = sqrt(a)
b = 1.0 / a
c = b - a
summation = SUM(a)
enddo
a(n/2) = 13.0
print*, "Is the middle value 13.0? ", a(n/2-1), a(n/2), a(n/2+1)
print*, "Summation = ", summation
end program junk
--
Summary: Code inside loop hangs; outside loop runs normally; runs
OK on other compilers
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kornkven at arsc dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
@ 2006-08-31 2:06 ` kargl at gcc dot gnu dot org
2006-08-31 2:47 ` kargl at gcc dot gnu dot org
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-08-31 2:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kargl at gcc dot gnu dot org 2006-08-31 02:06 -------
Upgrade gfortran to at least 4.1.1. The code works
fine with gfortran 4.2.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
2006-08-31 2:06 ` [Bug fortran/28914] " kargl at gcc dot gnu dot org
@ 2006-08-31 2:47 ` kargl at gcc dot gnu dot org
2006-08-31 5:28 ` jvdelisle at gcc dot gnu dot org
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: kargl at gcc dot gnu dot org @ 2006-08-31 2:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from kargl at gcc dot gnu dot org 2006-08-31 02:47 -------
Well, you do need to upgrade your compiler, but there appears to be
a bug :(
If n <= 65000, the program works fine. For larger n, the combination
of
do i = 1, 1
a = (/ (i, i = 1, n) /)
end do
i as the do-loop index and i as the implied-do-loop index is
causing problems. Normally, one cannot alter the do-loop
index within the body of the loop. ISTR from the F95 standard,
that the i in the implied-do-loop has the scope of only the
implied-do-loop. Thus, the above code is legal.
Why there is a change in behavior at i = 65000 (or so), I have
no idea.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|0000-00-00 00:00:00 |2006-08-31 02:47:50
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
2006-08-31 2:06 ` [Bug fortran/28914] " kargl at gcc dot gnu dot org
2006-08-31 2:47 ` kargl at gcc dot gnu dot org
@ 2006-08-31 5:28 ` jvdelisle at gcc dot gnu dot org
2006-09-01 13:45 ` paul dot richard dot thomas at cea dot fr
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-08-31 5:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2006-08-31 05:28 -------
Setting the parameter n=65535, the program appears to execute correctly.
However, the pr28914.f90.003t.original file is 706800 bytes long and embedded
with a very large static declaration of the array. As if it has been inlined.
With n=66536, the dump file is 4436 bytes long and has code to initialize the
array with a loop. That looping code appears broken.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (2 preceding siblings ...)
2006-08-31 5:28 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-01 13:45 ` paul dot richard dot thomas at cea dot fr
2006-09-01 13:49 ` paul dot richard dot thomas at cea dot fr
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-09-01 13:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paul dot richard dot thomas at cea dot fr 2006-09-01 13:45 -------
(In reply to comment #3)
> Setting the parameter n=65535, the program appears to execute correctly.
> However, the pr28914.f90.003t.original file is 706800 bytes long and embedded
> with a very large static declaration of the array. As if it has been inlined.
> With n=66536, the dump file is 4436 bytes long and has code to initialize the
> array with a loop. That looping code appears broken.
The looping code, of itself, is not broken. If one of the 'i's, say in the
implied do-loop, is changed to 'j', the code runs to completion. The problem
is that the implied do-loop counter uses a variable declaration and so a
symbol. This clashes with the variable i.
Since do-loops can run with +ve or -ve steps, the end condition is enforced
through:
L.1:;
D.931 = i == 1;
i = i + 1;
if (D.931) goto L.2; else (void) 0;
ie. with an equality. The implied do-loop sets this larger than 1 so the loop
never stops.
For n < 65536, the loop is simplified out of existence and the large static
array makes its appearance. This seems to be an undesirable consequence of
treating array initializers and array constructors with the same limit.
I would:
(i) Change the size limit for simplification of array constructors; and
(ii) Store the current value of the loop counter in a temporary and restore it
after the array constructor has done its thing (patch follows).
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (3 preceding siblings ...)
2006-09-01 13:45 ` paul dot richard dot thomas at cea dot fr
@ 2006-09-01 13:49 ` paul dot richard dot thomas at cea dot fr
2006-09-02 19:25 ` jvdelisle at gcc dot gnu dot org
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-09-01 13:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paul dot richard dot thomas at cea dot fr 2006-09-01 13:48 -------
Created an attachment (id=12168)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12168&action=view)
A provisional fix for the problem
This is not regtested.
Also, I know that there is a better way to detect a declared variable; however,
I am up to my eyeballs getting TR15541 out of the door... wait a few days, I
will sort this one.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (4 preceding siblings ...)
2006-09-01 13:49 ` paul dot richard dot thomas at cea dot fr
@ 2006-09-02 19:25 ` jvdelisle at gcc dot gnu dot org
2006-09-03 3:44 ` jvdelisle at gcc dot gnu dot org
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-02 19:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jvdelisle at gcc dot gnu dot org 2006-09-02 19:24 -------
I tested the provisional patch on i686-linux-pc-gnu.
Had to set tmp_loopvar = NULL when declared to avoid warning message on
possibly uninitialized variable.
Fixes the test case in this PR. Regression testsd fine.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (5 preceding siblings ...)
2006-09-02 19:25 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-03 3:44 ` jvdelisle at gcc dot gnu dot org
2006-09-04 12:08 ` paul dot richard dot thomas at cea dot fr
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-03 3:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jvdelisle at gcc dot gnu dot org 2006-09-03 03:44 -------
Just an added note. Compile time for large values of n is very long. Many
seconds. For n - 20000000
$ time gfc pr28914.f90
real 1m5.009s
user 1m3.896s
sys 0m0.048s
This is on 3.2 gigahertz machine. The resulting executable is about 10kbytes
in size.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (6 preceding siblings ...)
2006-09-03 3:44 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-04 12:08 ` paul dot richard dot thomas at cea dot fr
2006-09-04 19:33 ` jvdelisle at gcc dot gnu dot org
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-09-04 12:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paul dot richard dot thomas at cea dot fr 2006-09-04 12:08 -------
Even simpler is:
trans-array.c(gfc_trans_array_constructor_value)
replace loopvar = se.expr;
by loopvar = gfc_evaluate_now (se.expr, pblock);
gfc_expand_constructor is called from resolve_expr and from three places in
expr.c. As far as I can tell, non-initialization expressions only try the
expansion from resolve_expr. If I flag the calls to distinguish them and limit
the maximum number of expanded elements to 10, say, in gfc_expand_constructor,
the code reflects this but the compilation time does not. Something, somewhere
is doing a temporary expansion of the constructor, which is taking all the
time.
I have to leave this again but I will get to the bottom of it.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (7 preceding siblings ...)
2006-09-04 12:08 ` paul dot richard dot thomas at cea dot fr
@ 2006-09-04 19:33 ` jvdelisle at gcc dot gnu dot org
2006-09-05 19:38 ` pault at gcc dot gnu dot org
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-04 19:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jvdelisle at gcc dot gnu dot org 2006-09-04 19:33 -------
The proposed change in comment #8 appears to give several testsuite failures.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (8 preceding siblings ...)
2006-09-04 19:33 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-05 19:38 ` pault at gcc dot gnu dot org
2006-09-10 4:18 ` jvdelisle at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-09-05 19:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pault at gcc dot gnu dot org 2006-09-05 19:38 -------
(In reply to comment #9)
> The proposed change in comment #8 appears to give several testsuite failures.
>
Yes, I know; see the email that I sent you today. The original patch on #5
works fine and is nearly the right solution.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (9 preceding siblings ...)
2006-09-05 19:38 ` pault at gcc dot gnu dot org
@ 2006-09-10 4:18 ` jvdelisle at gcc dot gnu dot org
2006-09-10 4:53 ` jvdelisle at gcc dot gnu dot org
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-10 4:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from jvdelisle at gcc dot gnu dot org 2006-09-10 04:18 -------
Apatch for this bug has been submitted to the fortran list for approval.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jvdelisle at gcc dot gnu dot
|dot org |org
Status|WAITING |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|2006-08-31 02:47:50 |2006-09-10 04:18:51
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (10 preceding siblings ...)
2006-09-10 4:18 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-10 4:53 ` jvdelisle at gcc dot gnu dot org
2006-09-10 4:58 ` jvdelisle at gcc dot gnu dot org
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-10 4:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jvdelisle at gcc dot gnu dot org 2006-09-10 04:53 -------
Subject: Bug 28914
Author: jvdelisle
Date: Sun Sep 10 04:53:18 2006
New Revision: 116808
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116808
Log:
2006-09-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28914
* trans-array.c (gfc_trans_array_constructor_value): Create a temporary
loop variable to hold the current loop variable in case it is modified
by the array constructor.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (11 preceding siblings ...)
2006-09-10 4:53 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-10 4:58 ` jvdelisle at gcc dot gnu dot org
2006-09-10 5:08 ` jvdelisle at gcc dot gnu dot org
2006-09-10 14:42 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-10 4:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jvdelisle at gcc dot gnu dot org 2006-09-10 04:58 -------
Subject: Bug 28914
Author: jvdelisle
Date: Sun Sep 10 04:58:29 2006
New Revision: 116809
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116809
Log:
2006-09-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/28914
* gfortran.dg/actual_array_constructor_3.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/actual_array_constructor_3.f90
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (12 preceding siblings ...)
2006-09-10 4:58 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-10 5:08 ` jvdelisle at gcc dot gnu dot org
2006-09-10 14:42 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2006-09-10 5:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from jvdelisle at gcc dot gnu dot org 2006-09-10 05:07 -------
Fixed on 4.2 only, Follow PR20923 for long compile time issues.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/28914] Code inside loop hangs; outside loop runs normally; runs OK on other compilers
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
` (13 preceding siblings ...)
2006-09-10 5:08 ` jvdelisle at gcc dot gnu dot org
@ 2006-09-10 14:42 ` pinskia at gcc dot gnu dot org
14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-10 14:42 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28914
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-09-10 14:42 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-31 1:45 [Bug fortran/28914] New: Code inside loop hangs; outside loop runs normally; runs OK on other compilers kornkven at arsc dot edu
2006-08-31 2:06 ` [Bug fortran/28914] " kargl at gcc dot gnu dot org
2006-08-31 2:47 ` kargl at gcc dot gnu dot org
2006-08-31 5:28 ` jvdelisle at gcc dot gnu dot org
2006-09-01 13:45 ` paul dot richard dot thomas at cea dot fr
2006-09-01 13:49 ` paul dot richard dot thomas at cea dot fr
2006-09-02 19:25 ` jvdelisle at gcc dot gnu dot org
2006-09-03 3:44 ` jvdelisle at gcc dot gnu dot org
2006-09-04 12:08 ` paul dot richard dot thomas at cea dot fr
2006-09-04 19:33 ` jvdelisle at gcc dot gnu dot org
2006-09-05 19:38 ` pault at gcc dot gnu dot org
2006-09-10 4:18 ` jvdelisle at gcc dot gnu dot org
2006-09-10 4:53 ` jvdelisle at gcc dot gnu dot org
2006-09-10 4:58 ` jvdelisle at gcc dot gnu dot org
2006-09-10 5:08 ` jvdelisle at gcc dot gnu dot org
2006-09-10 14:42 ` pinskia 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).