* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
@ 2007-04-26 21:47 ` tkoenig at gcc dot gnu dot org
2007-05-01 13:18 ` tkoenig at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-04-26 21:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tkoenig at gcc dot gnu dot org 2007-04-26 22:47 -------
My analysis in the original bug report wasn't correct.
Here is a shorter version:
$ cat real-dim-2.f90
program main
real :: a(2.0),b(2.0)
a = b
end program main
$ gfortran real-dim-2.f90
real-dim-2.f90:2.12:
real :: a(2.0),b(2.0)
1
Error: Expression at (1) must be of INTEGER type
real-dim-2.f90:2.16:
real :: a(2.0),b(2.0)
1
Error: The module or main program array 'a' at (1) must have constant shape
real-dim-2.f90:2.19:
real :: a(2.0),b(2.0)
1
Error: Expression at (1) must be of INTEGER type
real-dim-2.f90:2.23:
real :: a(2.0),b(2.0)
1
Error: The module or main program array 'b' at (1) must have constant shape
real-dim-2.f90:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|segfault after mixing |segfault with real array
|declarations and executable |bounds
|statements |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
2007-04-26 21:47 ` [Bug fortran/31716] segfault with real array bounds tkoenig at gcc dot gnu dot org
@ 2007-05-01 13:18 ` tkoenig at gcc dot gnu dot org
2007-05-01 13:56 ` jvdelisle at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-05-01 13:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tkoenig at gcc dot gnu dot org 2007-05-01 14:18 -------
Closely related to PR 31251.
--
tkoenig at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |31251
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
2007-04-26 21:47 ` [Bug fortran/31716] segfault with real array bounds tkoenig at gcc dot gnu dot org
2007-05-01 13:18 ` tkoenig at gcc dot gnu dot org
@ 2007-05-01 13:56 ` jvdelisle at gcc dot gnu dot org
2007-05-02 3:19 ` jvdelisle at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-01 13:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2007-05-01 14:55 -------
As with pr31251, I do not see the segfault here.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (2 preceding siblings ...)
2007-05-01 13:56 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-02 3:19 ` jvdelisle at gcc dot gnu dot org
2007-05-12 5:03 ` jvdelisle at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-02 3:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jvdelisle at gcc dot gnu dot org 2007-05-02 04:19 -------
I attached a patch to pr31251, can someone try that and see what effect it has
on this one.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (3 preceding siblings ...)
2007-05-02 3:19 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-12 5:03 ` jvdelisle at gcc dot gnu dot org
2007-05-17 19:27 ` dfranke at gcc dot gnu dot org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-12 5:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jvdelisle at gcc dot gnu dot org 2007-05-12 06:02 -------
In the expr for a or b, the lower bound is coming up BT_INTEGER and the upper
bound is BT_REAL. Eventually we hit the error for wrong type. Then, because
this fails to resolve, that is interpreted by resolve_fl_variable to mean "The
module or main program array 'a' at (1) must have constant shape" when this
really is not the case.
In resolve_symbol, everything is tried to resolve a symbol, regardless of
previously issues errors at lower levels. Might want to rethink that approach.
I can not reproduce the segfault, so if I can get a backtrace it would help.
I also wonder if the best way to solve this is at the matcher level and throw a
syntax error when we see a period in the integer value we are expecting and be
done with all the other complexities. ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (4 preceding siblings ...)
2007-05-12 5:03 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-17 19:27 ` dfranke at gcc dot gnu dot org
2007-05-18 2:13 ` jvdelisle at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-17 19:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from dfranke at gcc dot gnu dot org 2007-05-17 20:27 -------
> I can not reproduce the segfault, so if I can get a backtrace it would help.
Jerry, I hope this helps. Let me know if you need something else :)
$> gfortran-svn -v
gcc version 4.3.0 20070517 (experimental)
(gdb) bt
#0 0xb7e926b1 in __gmpz_sub () from /usr/lib/libgmp.so.3
#1 0x080503d6 in spec_dimen_size (as=0x887f6e0, dimen=0, result=0xbf8ade38)
at ../../../gcc/gcc/fortran/array.c:1733
#2 0x08093494 in expression_rank (e=0x887ffc8)
at ../../../gcc/gcc/fortran/resolve.c:3025
#3 0x08094726 in gfc_resolve_expr (e=0x887ffc8)
at ../../../gcc/gcc/fortran/resolve.c:3298
#4 0x080981e0 in resolve_code (code=0x887fe48, ns=0x88451b0)
at ../../../gcc/gcc/fortran/resolve.c:5158
#5 0x08097dfa in gfc_resolve_blocks (b=0x887fe08, ns=0x88451b0)
at ../../../gcc/gcc/fortran/resolve.c:5091
#6 0x080981c6 in resolve_code (code=0x887f3e0, ns=0x88451b0)
at ../../../gcc/gcc/fortran/resolve.c:5150
#7 0x08099bb5 in resolve_codes (ns=0x88451b0)
at ../../../gcc/gcc/fortran/resolve.c:7452
#8 0x08099bf3 in gfc_resolve (ns=0x88451b0)
at ../../../gcc/gcc/fortran/resolve.c:7471
#9 0x0808d69c in gfc_parse_file () at ../../../gcc/gcc/fortran/parse.c:3248
#10 0x080aea4d in gfc_be_parse_file (set_yydebug=0)
at ../../../gcc/gcc/fortran/f95-lang.c:303
#11 0x082ffdf8 in toplev_main (argc=2, argv=0xbf8ae2c4)
at ../../../gcc/gcc/toplev.c:1051
#12 0x080f25bf in main (argc=Cannot access memory at address 0x0
) at ../../../gcc/gcc/main.c:35
$> gfortran-4.2 -v
gcc version 4.2.1 20070517 (prerelease)
(gdb) bt
#0 0xb7ed46b1 in __gmpz_sub () from /usr/lib/libgmp.so.3
#1 0x0804f15d in spec_dimen_size (as=0x8611440, dimen=0, result=0xbff27cf8) at
/home/daniel/svn/gcc-4.2/gcc/fortran/array.c:1735
#2 0x0808fdaf in expression_rank (e=0x8611d00) at
/home/daniel/svn/gcc-4.2/gcc/fortran/resolve.c:3023
#3 0x08090f9e in gfc_resolve_expr (e=0x8611d00) at
/home/daniel/svn/gcc-4.2/gcc/fortran/resolve.c:3230
#4 0x080944f4 in resolve_code (code=0x8612080, ns=0x8610ad8) at
/home/daniel/svn/gcc-4.2/gcc/fortran/resolve.c:5038
#5 0x0809724d in gfc_resolve_blocks (b=0x8611af8, ns=0x8610ad8) at
/home/daniel/svn/gcc-4.2/gcc/fortran/resolve.c:4973
#6 0x080944da in resolve_code (code=0x8611c40, ns=0x8610ad8) at
/home/daniel/svn/gcc-4.2/gcc/fortran/resolve.c:5030
#7 0x08095e33 in gfc_resolve (ns=0x8610ad8) at
/home/daniel/svn/gcc-4.2/gcc/fortran/resolve.c:7312
#8 0x0808a309 in gfc_parse_file () at
/home/daniel/svn/gcc-4.2/gcc/fortran/parse.c:3222
#9 0x080ac02d in gfc_be_parse_file (set_yydebug=0) at
/home/daniel/svn/gcc-4.2/gcc/fortran/f95-lang.c:303
#10 0x08310faa in toplev_main (argc=2, argv=0xbff28134) at
/home/daniel/svn/gcc-4.2/gcc/toplev.c:1033
#11 0x080d893f in main (argc=Cannot access memory at address 0x0
) at /home/daniel/svn/gcc-4.2/gcc/main.c:35
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.2.1 4.3.0
Last reconfirmed|0000-00-00 00:00:00 |2007-05-17 20:27:21
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (5 preceding siblings ...)
2007-05-17 19:27 ` dfranke at gcc dot gnu dot org
@ 2007-05-18 2:13 ` jvdelisle at gcc dot gnu dot org
2007-05-18 7:50 ` dfranke at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-18 2:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jvdelisle at gcc dot gnu dot org 2007-05-18 03:12 -------
Created an attachment (id=13575)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13575&action=view)
Possible patch for this problem
Daniel, Please try this patch and see if eliminates the segfault. TIA
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (6 preceding siblings ...)
2007-05-18 2:13 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-18 7:50 ` dfranke at gcc dot gnu dot org
2007-05-18 7:53 ` dfranke at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-18 7:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from dfranke at gcc dot gnu dot org 2007-05-18 08:50 -------
Jerry, the patch eliminates the ICE and regtests cleanly.
$> cat pr31716.f90
program main
real, parameter :: n = 1024, iter=1000
real, dimension(n) :: num1,num2
call random_number(num1)
do i=1,iter
num2 = num1**2
end do
end program main
$> gfortran-svn -Wall pr31760.f90
pr31760.f90:3.18:
real, dimension(n) :: num1,num2
1
Error: Expression at (1) must be of INTEGER type
pr31760.f90:3.33:
real, dimension(n) :: num1,num2
1
Error: The module or main program array 'num2' at (1) must have constant shape
pr31760.f90:3.18:
real, dimension(n) :: num1,num2
1
Error: Expression at (1) must be of INTEGER type
pr31760.f90:3.28:
real, dimension(n) :: num1,num2
1
Error: The module or main program array 'num1' at (1) must have constant shape
The messages "must have constant shape" puzzles me as N is a PARAMETER?!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (7 preceding siblings ...)
2007-05-18 7:50 ` dfranke at gcc dot gnu dot org
@ 2007-05-18 7:53 ` dfranke at gcc dot gnu dot org
2007-05-18 22:59 ` jvdelisle at gcc dot gnu dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-18 7:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from dfranke at gcc dot gnu dot org 2007-05-18 08:53 -------
> $> gfortran-svn -Wall pr31760.f90
This should of course read "gfortran-svn -Wall pr31716.f90" - the contents of
the file does correspond to this PR, the file name does not ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (8 preceding siblings ...)
2007-05-18 7:53 ` dfranke at gcc dot gnu dot org
@ 2007-05-18 22:59 ` jvdelisle at gcc dot gnu dot org
2007-05-19 0:30 ` patchapp at dberlin dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-18 22:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jvdelisle at gcc dot gnu dot org 2007-05-18 23:58 -------
Have to remind myself to submit the patch. The odd messages are from trying to
match and resolve other things, after failing already. I am working on a patch
to try circumvent some of these. Garbage in Garbage Out though. :)
--
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|NEW |ASSIGNED
Last reconfirmed|2007-05-17 20:27:21 |2007-05-18 23:58:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (9 preceding siblings ...)
2007-05-18 22:59 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-19 0:30 ` patchapp at dberlin dot org
2007-05-24 5:04 ` jvdelisle at gcc dot gnu dot org
2007-05-24 5:06 ` jvdelisle at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: patchapp at dberlin dot org @ 2007-05-19 0:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from patchapp at dberlin dot org 2007-05-19 01:30 -------
Subject: Bug number PR31716
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01265.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (10 preceding siblings ...)
2007-05-19 0:30 ` patchapp at dberlin dot org
@ 2007-05-24 5:04 ` jvdelisle at gcc dot gnu dot org
2007-05-24 5:06 ` jvdelisle at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24 5:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jvdelisle at gcc dot gnu dot org 2007-05-24 06:04 -------
Subject: Bug 31716
Author: jvdelisle
Date: Thu May 24 05:03:51 2007
New Revision: 125013
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125013
Log:
2007-05-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/31716
* array.c (spec_dimen_size): Test for correct BT_INTEGER type.
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/array.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug fortran/31716] segfault with real array bounds
2007-04-26 18:50 [Bug fortran/31716] New: segfault after mixing declarations and executable statements tkoenig at gcc dot gnu dot org
` (11 preceding siblings ...)
2007-05-24 5:04 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-24 5:06 ` jvdelisle at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-24 5:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from jvdelisle at gcc dot gnu dot org 2007-05-24 06:05 -------
Fixed on trunk.
--
jvdelisle at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31716
^ permalink raw reply [flat|nested] 14+ messages in thread