public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
@ 2007-07-08 22:41 jaydub66 at gmail dot com
2007-07-09 6:01 ` [Bug fortran/32682] " burnus at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: jaydub66 at gmail dot com @ 2007-07-08 22:41 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1574 bytes --]
consider the following program:
program matrix
implicit none
real,dimension(2,2),parameter::c=0
real,dimension(2,2)::m
m=f()+c
m=c+f()
call sub(m+f())
call sub(c+m)
call sub(f()+c)
call sub(c+f())
contains
function f()
implicit none
real, dimension(2,2)::f
f=0
end function f
subroutine sub(a)
implicit none
real, dimension(2,2)::a
end subroutine sub
end program matrix
this gives the error message:
matrix.f90: In function MAIN__:
matrix.f90:11: internal compiler error: in gfc_trans_array_constructor, at
fortran/trans-array.c:1664
though the message claims an error in line 11, the program only fails in the
presence of line 12:
"call sub(c+f())"
all the lines before (7-11) are ok.
the ICE only appears in exactly this configuration, i.e. c is a parameter, f is
a function, and c+f() is fed as an argument to a subroutine
it happens in trans-array.c(gfc_trans_array_constructor), line 1664:
/* We should have a 1-dimensional, zero-based loop. */
gcc_assert (loop->dimen == 1);
this fails with loop->dimen==2 in our case
happens only with 4.3 (trunk), but not with 4.1 or 4.2
--
Summary: [4.3 Regression] ICE in gfc_trans_array_constructor, at
fortran/trans-array.c:1664
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jaydub66 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
@ 2007-07-09 6:01 ` burnus at gcc dot gnu dot org
2007-07-09 8:15 ` tobias dot burnus at physik dot fu-berlin dot de
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-09 6:01 UTC (permalink / raw)
To: gcc-bugs
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-07-09 06:01:16
date| |
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
2007-07-09 6:01 ` [Bug fortran/32682] " burnus at gcc dot gnu dot org
@ 2007-07-09 8:15 ` tobias dot burnus at physik dot fu-berlin dot de
2007-07-09 19:17 ` jaydub66 at gmail dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2007-07-09 8:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tobias dot burnus at physik dot fu-berlin dot de 2007-07-09 08:15 -------
Note: The program fails with
"call sub(c+f())"
where c is a parameter and dimensions of c and f are (2,2). If one has
dimension(2) it works.
Working with 2007-05-08-r124539, failing with 2007-05-09-r124566.
The follwing has been checked in during that time:
r124550 | pault | 2007-05-08 16:40:58 +0200 (Tue, 08 May 2007) | 7 lines
PR 31630
* resolve.c (resolve_symbol): Remove the flagging mechanism from the...
r124546 | pault | 2007-05-08 14:45:31 +0200 (Tue, 08 May 2007) | 11 lines
PR 31692
* trans-array.c (gfc_conv_array_parameter): Convert full array
references to the result of the procedure enclusing the call.
r124541 | pault | 2007-05-08 13:58:25 +0200 (Tue, 08 May 2007) | 18 lines
PR 29397, PR 29400
* decl.c (add_init_expr_to_sym): Expand a scalar initializer
for a parameter array into an array expression with the right
shape.
* array.c (spec_dimen_size): Remove static attribute.
* gfortran.h : Prototype for spec_dimen_size.
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00406.html
I think the last-shown commit caused the regression.
--
tobias dot burnus at physik dot fu-berlin dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
2007-07-09 6:01 ` [Bug fortran/32682] " burnus at gcc dot gnu dot org
2007-07-09 8:15 ` tobias dot burnus at physik dot fu-berlin dot de
@ 2007-07-09 19:17 ` jaydub66 at gmail dot com
2007-07-09 22:40 ` pault at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jaydub66 at gmail dot com @ 2007-07-09 19:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jaydub66 at gmail dot com 2007-07-09 19:17 -------
I checked it: The ICE is really introduced by rev. 124541.
> r124541 | pault | 2007-05-08 13:58:25 +0200 (Tue, 08 May 2007) | 18 lines
> PR 29397, PR 29400
> * decl.c (add_init_expr_to_sym): Expand a scalar initializer
> for a parameter array into an array expression with the right
> shape.
> * array.c (spec_dimen_size): Remove static attribute.
> * gfortran.h : Prototype for spec_dimen_size.
> http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00406.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (2 preceding siblings ...)
2007-07-09 19:17 ` jaydub66 at gmail dot com
@ 2007-07-09 22:40 ` pault at gcc dot gnu dot org
2007-07-11 21:39 ` jaydub66 at gmail dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-09 22:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pault at gcc dot gnu dot org 2007-07-09 22:40 -------
(In reply to comment #2)
Whilst I agree that this is a regession, it is so because an underlying bug is
exposed - in other words, r124541 is perfectly correct.
The following also fails:
program matrix
implicit none
real,dimension(2,2),parameter::c=reshape((/1,2,3,4/),(/2,2/))
real,dimension(2,2)::m
m=f()+c
m=c+f()
call sub(m+f())
call sub(c+m)
call sub(f()+c)
call sub(c+f())
contains
function f()
implicit none
real, dimension(2,2)::f
f=0
end function f
subroutine sub(a)
implicit none
real, dimension(2,2)::a
print *, a
end subroutine sub
end program matrix
which was not affected by the above patch.
This fixes both versions of the bug:
Index: gcc/fortran/trans-array.c
===================================================================
*** gcc/fortran/trans-array.c (revision 126461)
--- gcc/fortran/trans-array.c (working copy)
*************** gfc_trans_array_constructor (gfc_loopinf
*** 1656,1661 ****
--- 1656,1673 ----
/* See if the constructor determines the loop bounds. */
dynamic = false;
+
+ if (ss->expr->shape && loop->to[0] == NULL_TREE)
+ {
+ int n;
+ for (n = 0; n < ss->expr->rank; n++)
+ {
+ loop->to[n] = gfc_conv_mpz_to_tree (ss->expr->shape [n],
+ gfc_index_integer_kind);
+ loop->from[n] = gfc_index_zero_node;
+ }
+ }
+
if (loop->to[0] == NULL_TREE)
{
mpz_t size;
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2007-07-09 06:01:16 |2007-07-09 22:40:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (3 preceding siblings ...)
2007-07-09 22:40 ` pault at gcc dot gnu dot org
@ 2007-07-11 21:39 ` jaydub66 at gmail dot com
2007-07-24 13:46 ` dfranke at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jaydub66 at gmail dot com @ 2007-07-11 21:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jaydub66 at gmail dot com 2007-07-11 21:39 -------
Paul,
I tested your patch, and indeed it does fix the problem for me. I also checked
it for regressions, and it doesn't seem to break anthing.
Cheers,
Janus
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (4 preceding siblings ...)
2007-07-11 21:39 ` jaydub66 at gmail dot com
@ 2007-07-24 13:46 ` dfranke at gcc dot gnu dot org
2007-07-27 15:09 ` pault at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-24 13:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dfranke at gcc dot gnu dot org 2007-07-24 13:45 -------
Paul, any plans to get the fix from comment #3 into trunk?
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (5 preceding siblings ...)
2007-07-24 13:46 ` dfranke at gcc dot gnu dot org
@ 2007-07-27 15:09 ` pault at gcc dot gnu dot org
2007-07-28 20:47 ` fxcoudert at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-27 15:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pault at gcc dot gnu dot org 2007-07-27 15:09 -------
(In reply to comment #5)
> Paul, any plans to get the fix from comment #3 into trunk?
>
Gee, Daniel - I had totally forgotten this one. Will do.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (6 preceding siblings ...)
2007-07-27 15:09 ` pault at gcc dot gnu dot org
@ 2007-07-28 20:47 ` fxcoudert at gcc dot gnu dot org
2007-07-29 11:21 ` pault at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-07-28 20:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2007-07-28 20:47 -------
(In reply to comment #3)
> Index: gcc/fortran/trans-array.c
> ===================================================================
> *** gcc/fortran/trans-array.c (revision 126461)
> --- gcc/fortran/trans-array.c (working copy)
> *************** gfc_trans_array_constructor (gfc_loopinf
> *** 1656,1661 ****
> --- 1656,1673 ----
>
> /* See if the constructor determines the loop bounds. */
> dynamic = false;
> +
> + if (ss->expr->shape && loop->to[0] == NULL_TREE)
> + {
> + int n;
> + for (n = 0; n < ss->expr->rank; n++)
> + {
> + loop->to[n] = gfc_conv_mpz_to_tree (ss->expr->shape [n],
> + gfc_index_integer_kind);
> + loop->from[n] = gfc_index_zero_node;
> + }
> + }
> +
> if (loop->to[0] == NULL_TREE)
> {
> mpz_t size;
This is OK to commit.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (7 preceding siblings ...)
2007-07-28 20:47 ` fxcoudert at gcc dot gnu dot org
@ 2007-07-29 11:21 ` pault at gcc dot gnu dot org
2007-07-29 14:44 ` pault at gcc dot gnu dot org
2007-07-29 14:45 ` pault at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-29 11:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pault at gcc dot gnu dot org 2007-07-29 11:21 -------
(In reply to comment #7)
> (In reply to comment #3)
> This is OK to commit.
>
FX,
In developing the testcase, I found out that this version of the patch is wrong
- change 'f=0' to 'f=42' to see what I mean (look at the last line).
The loop should be unity based and then it works fine.
I will commit after regtesting.
Thanks
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (8 preceding siblings ...)
2007-07-29 11:21 ` pault at gcc dot gnu dot org
@ 2007-07-29 14:44 ` pault at gcc dot gnu dot org
2007-07-29 14:45 ` pault at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-29 14:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from pault at gcc dot gnu dot org 2007-07-29 14:44 -------
Subject: Bug 32682
Author: pault
Date: Sun Jul 29 14:44:03 2007
New Revision: 127044
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127044
Log:
2007-07-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31211
* trans-expr.c (gfc_conv_expr_reference): Add block for case of
scalar pointer functions so that NULL result is correctly
handled.
PR fortran/32682
*trans-array.c (gfc_trans_array_constructor): On detecting a
multi-dimensional parameter array, set the loop limits.
2007-07-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31211
* gfortran.dg/actual_pointer_function_1.f90: New test.
PR fortran/32682
* gfortran.dg/scalarize_parameter_array_1.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/actual_pointer_function_1.f90
trunk/gcc/testsuite/gfortran.dg/scalarize_parameter_array_1.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug fortran/32682] [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
` (9 preceding siblings ...)
2007-07-29 14:44 ` pault at gcc dot gnu dot org
@ 2007-07-29 14:45 ` pault at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-29 14:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from pault at gcc dot gnu dot org 2007-07-29 14:45 -------
Fixed on trunk with correction to be unity rather than zero based.
Paul
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32682
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-07-29 14:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-08 22:41 [Bug fortran/32682] New: [4.3 Regression] ICE in gfc_trans_array_constructor, at fortran/trans-array.c:1664 jaydub66 at gmail dot com
2007-07-09 6:01 ` [Bug fortran/32682] " burnus at gcc dot gnu dot org
2007-07-09 8:15 ` tobias dot burnus at physik dot fu-berlin dot de
2007-07-09 19:17 ` jaydub66 at gmail dot com
2007-07-09 22:40 ` pault at gcc dot gnu dot org
2007-07-11 21:39 ` jaydub66 at gmail dot com
2007-07-24 13:46 ` dfranke at gcc dot gnu dot org
2007-07-27 15:09 ` pault at gcc dot gnu dot org
2007-07-28 20:47 ` fxcoudert at gcc dot gnu dot org
2007-07-29 11:21 ` pault at gcc dot gnu dot org
2007-07-29 14:44 ` pault at gcc dot gnu dot org
2007-07-29 14:45 ` 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).