public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference
@ 2012-11-02  0:44 john.harper at vuw dot ac.nz
  2012-11-02  2:57 ` [Bug fortran/55174] " kargl at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: john.harper at vuw dot ac.nz @ 2012-11-02  0:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

             Bug #: 55174
           Summary: internal compiler error: Segmentation fault with bad
                    array reference
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: john.harper@vuw.ac.nz


This 4-line Fortran program has an error at line 3, where array(*) is of course
not permitted as an argument of a function.

implicit none
integer:: array(2)=(/42,666/)
print *, size(array(*))
end

Other compilers (g95, ifort) correctly diagnose the error but gfortran 4.8.0 
gives an internal compiler error: Segmentation fault and asks me to tell you.
My compile-time output follows.

cayley[~/Jfh] % /local/scratch/gf/bin/gfortran -v trybadstar.f90
Driving: /local/scratch/gf/bin/gfortran -v trybadstar.f90 -l gfortran -l m
-shared-libgcc
Using built-in specs.
COLLECT_GCC=/local/scratch/gf/bin/gfortran
COLLECT_LTO_WRAPPER=/local/scratch/gf/libexec/gcc/i686-pc-linux-gnu/4.8.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /local/scratch/gcc-4.8-20120701/configure
--prefix=/local/scratch/gf --enable-languages=c,fortran --disable-libada
--with-local-prefix=/local/scratch --with-gmp=/local/scratch
Thread model: posix
gcc version 4.8.0 20120701 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=pentiumpro'
 /local/scratch/gf/libexec/gcc/i686-pc-linux-gnu/4.8.0/f951 trybadstar.f90
-quiet -dumpbase trybadstar.f90 -mtune=generic -march=pentiumpro -auxbase
trybadstar -version -fintrinsic-modules-path
/local/scratch/gf/lib/gcc/i686-pc-linux-gnu/4.8.0/finclude -o /tmp/cccgAIgM.s
GNU Fortran (GCC) version 4.8.0 20120701 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.8.0 20120701 (experimental), GMP version
5.0.5, MPFR version 3.1.0, MPC version 0.9
warning: GMP header version 5.0.5 differs from library version 5.0.3.
warning: MPFR header version 3.1.0 differs from library version 3.1.0-p3.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.8.0 20120701 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.8.0 20120701 (experimental), GMP version
5.0.5, MPFR version 3.1.0, MPC version 0.9
warning: GMP header version 5.0.5 differs from library version 5.0.3.
warning: MPFR header version 3.1.0 differs from library version 3.1.0-p3.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
cayley[~/Jfh] %


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/55174] internal compiler error: Segmentation fault with bad array reference
  2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
@ 2012-11-02  2:57 ` kargl at gcc dot gnu.org
  2012-11-02 10:55 ` [Bug fortran/55174] [4.6 Regression] " janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu.org @ 2012-11-02  2:57 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2012-11-02 02:57:36 UTC ---
(In reply to comment #0)
> This 4-line Fortran program has an error at line 3, where array(*) is of course
> not permitted as an argument of a function.
> 
> implicit none
> integer:: array(2)=(/42,666/)
> print *, size(array(*))
> end
> 
> Other compilers (g95, ifort) correctly diagnose the error but gfortran 4.8.0 
> gives an internal compiler error: Segmentation fault and asks me to tell you.
> My compile-time output follows.
> 
> cayley[~/Jfh] % /local/scratch/gf/bin/gfortran -v trybadstar.f90
> Driving: /local/scratch/gf/bin/gfortran -v trybadstar.f90 -l gfortran -l m
> -shared-libgcc
> Using built-in specs.
> COLLECT_GCC=/local/scratch/gf/bin/gfortran
> COLLECT_LTO_WRAPPER=/local/scratch/gf/libexec/gcc/i686-pc-linux-gnu/4.8.0/lto-wrapper
> Target: i686-pc-linux-gnu
> Configured with: /local/scratch/gcc-4.8-20120701/configure
> --prefix=/local/scratch/gf --enable-languages=c,fortran --disable-libada
> --with-local-prefix=/local/scratch --with-gmp=/local/scratch
> Thread model: posix
> gcc version 4.8.0 20120701 (experimental) (GCC) 

John,

It looks like it has been fixed on trunk (aka 4.8.0).
For me, gfc4x is 4.8.0 20121002.  gfortran 4.5.x 
seems to also work, so it appears that a regression
crept in in the 4.6. development.

troutmask:sgk[209] gfc4x -o z k.f90
k.f90:2.20:

print *, size(array(*))
                    1
Error: Expected array subscript at (1)
troutmask:sgk[210] gfc47 -o z k.f90
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
troutmask:sgk[211] gfc46 -o z k.f90
f951: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
troutmask:sgk[212] gfc45 -o z k.f90
k.f90:2.20:

print *, size(array(*))
                    1
Error: Expected array subscript at (1)

A quick scan of gcc/fortran/ChangeLog did not reveal
an obvious candidate for the revision that fixed the
problem.  We should probably add your test to the
testsuite to make sure it does not get broken, again.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad array reference
  2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
  2012-11-02  2:57 ` [Bug fortran/55174] " kargl at gcc dot gnu.org
@ 2012-11-02 10:55 ` janus at gcc dot gnu.org
  2012-11-04 20:41 ` harper at msor dot vuw.ac.nz
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-02 10:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-11-02
                 CC|                            |janus at gcc dot gnu.org
            Summary|internal compiler error:    |[4.6 Regression]
                   |Segmentation fault with bad |Segmentation fault with bad
                   |array reference             |array reference
     Ever Confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org 2012-11-02 10:54:50 UTC ---
(In reply to comment #1)
> It looks like it has been fixed on trunk (aka 4.8.0).

For me it also works with:

gcc version 4.7.2 20120920 [gcc-4_7-branch revision 191568] (SUSE Linux)

(while it fails with 4.7.0 and 4.6.0).

Note: The 4.6 branch is still maintained, so we should consider fixing it
there.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad array reference
  2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
  2012-11-02  2:57 ` [Bug fortran/55174] " kargl at gcc dot gnu.org
  2012-11-02 10:55 ` [Bug fortran/55174] [4.6 Regression] " janus at gcc dot gnu.org
@ 2012-11-04 20:41 ` harper at msor dot vuw.ac.nz
  2012-11-04 22:23 ` janus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: harper at msor dot vuw.ac.nz @ 2012-11-04 20:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

--- Comment #3 from harper at msor dot vuw.ac.nz 2012-11-04 20:41:10 UTC ---
On Fri, 2 Nov 2012, janus at gcc dot gnu.org wrote:

> Date: Fri, 2 Nov 2012 10:54:50 +0000
> From: janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> To: john.harper@vuw.ac.nz
> Subject: [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad
>     array reference
> Resent-Date: Fri, 2 Nov 2012 10:55:07 +0000
> Resent-From: <john.harper@vuw.ac.nz>
> 
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174
>
> janus at gcc dot gnu.org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Keywords|                            |ice-on-invalid-code
>             Status|UNCONFIRMED                 |NEW
>   Last reconfirmed|                            |2012-11-02
>                 CC|                            |janus at gcc dot gnu.org
>            Summary|internal compiler error:    |[4.6 Regression]
>                   |Segmentation fault with bad |Segmentation fault with bad
>                   |array reference             |array reference
>     Ever Confirmed|0                           |1
>
> --- Comment #2 from janus at gcc dot gnu.org 2012-11-02 10:54:50 UTC ---
> (In reply to comment #1)
>> It looks like it has been fixed on trunk (aka 4.8.0).
>
> For me it also works with:
>
> gcc version 4.7.2 20120920 [gcc-4_7-branch revision 191568] (SUSE Linux)
>
> (while it fails with 4.7.0 and 4.6.0).
>
> Note: The 4.6 branch is still maintained, so we should consider fixing it
> there.
>
> -- 
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.

I have just tried gfortran 4.7.1 (x86_64-unknown-linux-gnu) and it
gave the internal compiler error with my program. So it seems that
4.7.0 and 4.7.1 both have the bug and 4.7.2 does not. Evidence:

miro[~]$ cat trybadstar.f90
implicit none
integer:: array(2)=(/42,666/)
print *, size(array(*))
end
miro[~]$ gf7 -v trybadstar.f90
Driving: /home/harperj1/gcc47/gf/bin/gfortran -v trybadstar.f90 -l 
gfortran -l m -shared-libgcc
Using built-in specs.
COLLECT_GCC=/home/harperj1/gcc47/gf/bin/gfortran
COLLECT_LTO_WRAPPER=/home/harperj1/gcc47/gf/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/harperj1/gcc47/gcc-4.7.1/configure 
--prefix=/home/harperj1/gcc47/gf --enable-languages=c,fortran 
--disable-libada --with-local-prefix=/home/harperj1/gcc47 
--with-gmp=/home/harperj1/gcc47
Thread model: posix
gcc version 4.7.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
  /home/harperj1/gcc47/gf/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/f951 
trybadstar.f90 -quiet -dumpbase trybadstar.f90 -mtune=generic 
-march=x86-64 -auxbase trybadstar -version -fintrinsic-modules-path 
/home/harperj1/gcc47/gf/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/finclude -o 
/tmp/ccFXH0I1.s
GNU Fortran (GCC) version 4.7.1 (x86_64-unknown-linux-gnu)
         compiled by GNU C version 4.7.1, GMP version 4.3.1, MPFR version 
2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (GCC) version 4.7.1 (x86_64-unknown-linux-gnu)
         compiled by GNU C version 4.7.1, GMP version 4.3.1, MPFR version 
2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
miro[~]$

-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5276 fax (+64)(4)463 5045


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad array reference
  2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
                   ` (2 preceding siblings ...)
  2012-11-04 20:41 ` harper at msor dot vuw.ac.nz
@ 2012-11-04 22:23 ` janus at gcc dot gnu.org
  2012-11-05  0:03 ` harper at msor dot vuw.ac.nz
  2012-11-05  0:52 ` harper at msor dot vuw.ac.nz
  5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-04 22:23 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #4 from janus at gcc dot gnu.org 2012-11-04 22:23:40 UTC ---
(In reply to comment #3)
> I have just tried gfortran 4.7.1 (x86_64-unknown-linux-gnu) and it
> gave the internal compiler error with my program. So it seems that
> 4.7.0 and 4.7.1 both have the bug and 4.7.2 does not.

Good. So it has been fixed between 4.7.1 and 4.7.2, apparently by this commit:

http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191216

This is the fix for PR 54225, and the good news is that it has also been
backported to the 4.6 branch and therefore will be part of the future 4.6.4
release.

So I think we can just close this as a duplicate of PR 54225.

Nevertheless, thanks for the bug report!

*** This bug has been marked as a duplicate of bug 54225 ***


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad array reference
  2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
                   ` (3 preceding siblings ...)
  2012-11-04 22:23 ` janus at gcc dot gnu.org
@ 2012-11-05  0:03 ` harper at msor dot vuw.ac.nz
  2012-11-05  0:52 ` harper at msor dot vuw.ac.nz
  5 siblings, 0 replies; 7+ messages in thread
From: harper at msor dot vuw.ac.nz @ 2012-11-05  0:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

--- Comment #5 from harper at msor dot vuw.ac.nz 2012-11-05 00:02:51 UTC ---
On Sun, 4 Nov 2012, janus at gcc dot gnu.org wrote:

> Date: Sun, 4 Nov 2012 22:23:40 +0000
> From: janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> To: john.harper@vuw.ac.nz
> Subject: [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad
>     array reference
> Resent-Date: Sun, 4 Nov 2012 22:24:00 +0000
> Resent-From: <john.harper@vuw.ac.nz>
> 
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174
>
> janus at gcc dot gnu.org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|NEW                         |RESOLVED
>         Resolution|                            |DUPLICATE
>
> --- Comment #4 from janus at gcc dot gnu.org 2012-11-04 22:23:40 UTC ---
> (In reply to comment #3)
>> I have just tried gfortran 4.7.1 (x86_64-unknown-linux-gnu) and it
>> gave the internal compiler error with my program. So it seems that
>> 4.7.0 and 4.7.1 both have the bug and 4.7.2 does not.
>
> Good. So it has been fixed between 4.7.1 and 4.7.2, apparently by this commit:
>
> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191216
>
> This is the fix for PR 54225, and the good news is that it has also been
> backported to the 4.6 branch and therefore will be part of the future 4.6.4
> release.
>
> So I think we can just close this as a duplicate of PR 54225.
>
> Nevertheless, thanks for the bug report!
>
> *** This bug has been marked as a duplicate of bug 54225 ***
>
> -- 
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.

You may well be right. I'll be convinced if your analysis also explains
why the bug was there in 4.8.0 of 20120701 but not in 4.8.0 of 20121002.


-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5276 fax (+64)(4)463 5045


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad array reference
  2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
                   ` (4 preceding siblings ...)
  2012-11-05  0:03 ` harper at msor dot vuw.ac.nz
@ 2012-11-05  0:52 ` harper at msor dot vuw.ac.nz
  5 siblings, 0 replies; 7+ messages in thread
From: harper at msor dot vuw.ac.nz @ 2012-11-05  0:52 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174

--- Comment #6 from harper at msor dot vuw.ac.nz 2012-11-05 00:52:10 UTC ---
On Mon, 5 Nov 2012, John Harper wrote:

> Date: Mon, 5 Nov 2012 13:02:37 +1300 (NZDT)
> From: John Harper <harper@msor.vuw.ac.nz>
> To: janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> Subject: Re: [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad
>     array reference
> 
> On Sun, 4 Nov 2012, janus at gcc dot gnu.org wrote:
>
>> Date: Sun, 4 Nov 2012 22:23:40 +0000
>> From: janus at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
>> To: john.harper@vuw.ac.nz
>> Subject: [Bug fortran/55174] [4.6 Regression] Segmentation fault with bad
>>     array reference
>> Resent-Date: Sun, 4 Nov 2012 22:24:00 +0000
>> Resent-From: <john.harper@vuw.ac.nz>
>> 
>> 
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55174
>> 
>> janus at gcc dot gnu.org changed:
>>
>>           What    |Removed                     |Added
>> 
>> ----------------------------------------------------------------------------
>>             Status|NEW                         |RESOLVED
>>         Resolution|                            |DUPLICATE
>> 
>> --- Comment #4 from janus at gcc dot gnu.org 2012-11-04 22:23:40 UTC ---
>> (In reply to comment #3)
>>> I have just tried gfortran 4.7.1 (x86_64-unknown-linux-gnu) and it
>>> gave the internal compiler error with my program. So it seems that
>>> 4.7.0 and 4.7.1 both have the bug and 4.7.2 does not.
>> 
>> Good. So it has been fixed between 4.7.1 and 4.7.2, apparently by this 
>> commit:
>> 
>> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191216
>> 
>> This is the fix for PR 54225, and the good news is that it has also been
>> backported to the 4.6 branch and therefore will be part of the future 4.6.4
>> release.
>> 
>> So I think we can just close this as a duplicate of PR 54225.
>> 
>> Nevertheless, thanks for the bug report!
>> 
>> *** This bug has been marked as a duplicate of bug 54225 ***
>> 
>> -- 
>> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
>> ------- You are receiving this mail because: -------
>> You reported the bug.
>
> You may well be right. I'll be convinced if your analysis also explains
> why the bug was there in 4.8.0 of 20120701 but not in 4.8.0 of 20121002.

Apologies - I should have looked carefully at the dates for bug 54225.
The bug was fixed between 20120701 and 20121002 so you are indeed right.

-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5276 fax (+64)(4)463 5045


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-05  0:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02  0:44 [Bug fortran/55174] New: internal compiler error: Segmentation fault with bad array reference john.harper at vuw dot ac.nz
2012-11-02  2:57 ` [Bug fortran/55174] " kargl at gcc dot gnu.org
2012-11-02 10:55 ` [Bug fortran/55174] [4.6 Regression] " janus at gcc dot gnu.org
2012-11-04 20:41 ` harper at msor dot vuw.ac.nz
2012-11-04 22:23 ` janus at gcc dot gnu.org
2012-11-05  0:03 ` harper at msor dot vuw.ac.nz
2012-11-05  0:52 ` harper at msor dot vuw.ac.nz

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).