public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46201] New: ICE using procedure pointer...
@ 2010-10-27 20:50 sjbespa at comcast dot net
  2010-10-27 21:48 ` [Bug fortran/46201] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: sjbespa at comcast dot net @ 2010-10-27 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE using procedure pointer...
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sjbespa@comcast.net


Created attachment 22181
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22181
module which generates the compiler crash described in PR

Compiler crash using attached example...

et: sjbespa$ /volumes/dev/gfortran-4.6-trunk/bin/gfortran -o test test_4.f90
test_4.f90: In function ‘test_subroutine’:
test_4.f90:24:0: 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.

==================
et: sjbespa$ /volumes/dev/gfortran-4.6-trunk/bin/gfortran -v
Using built-in specs.
COLLECT_GCC=/volumes/dev/gfortran-4.6-trunk/bin/gfortran
COLLECT_LTO_WRAPPER=/Volumes/dev/gfortran-4.6-trunk/bin/../libexec/gcc/x86_64-apple-darwin10.4.0/4.6.0/lto-wrapper
Target: x86_64-apple-darwin10.4.0
Configured with: ../gfortran-4.6-src/configure
--prefix=/volumes/dev/gfortran-4.6-trunk --enable-languages=fortran
--disable-bootstrap
Thread model: posix
gcc version 4.6.0 20101027 (experimental) (GCC)


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

* [Bug fortran/46201] ICE using procedure pointer...
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
@ 2010-10-27 21:48 ` burnus at gcc dot gnu.org
  2010-10-27 22:03 ` [Bug fortran/46201] [F03] ICE on procedure pointer component call janus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-27 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |janus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-27 21:48:17 UTC ---
The ICE happens for:
   nam = vars(ivar)%name(1)

where "name" is the PPC. It fails with 4.5 and 4.6. (4.4 does not support PPC.)

ICEs at:

==7160== Invalid read of size 8
==7160==    at 0x57365F: gfc_conv_procedure_call (trans-expr.c:3539)
==7160==    by 0x5742C1: gfc_conv_function_expr (trans-expr.c:3937)
==7160==    by 0x56DD39: gfc_trans_assignment_1 (trans-expr.c:5675)
==7160==    by 0x574AF9: gfc_trans_assignment (trans-expr.c:5847)

That's the line:  se->expr = info->descriptor;


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
  2010-10-27 21:48 ` [Bug fortran/46201] " burnus at gcc dot gnu.org
@ 2010-10-27 22:03 ` janus at gcc dot gnu.org
  2010-12-13 16:57 ` janus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2010-10-27 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.27 22:03:01
            Summary|ICE using procedure         |[F03] ICE on procedure
                   |pointer...                  |pointer component call
     Ever Confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org 2010-10-27 22:03:01 UTC ---
Here is a slightly reduced/modified test case:


implicit none

abstract interface
   character function name_func (ivar) result (res)
      integer, intent(in) :: ivar
   end function
end interface

type var_type
   procedure(name_func), nopass, pointer :: name
end type

type(var_type), dimension(1) :: vars

print *,vars(1)%name(1)

end


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
  2010-10-27 21:48 ` [Bug fortran/46201] " burnus at gcc dot gnu.org
  2010-10-27 22:03 ` [Bug fortran/46201] [F03] ICE on procedure pointer component call janus at gcc dot gnu.org
@ 2010-12-13 16:57 ` janus at gcc dot gnu.org
  2010-12-13 17:39 ` janus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2010-12-13 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from janus at gcc dot gnu.org 2010-12-13 16:57:20 UTC ---
Here is an even more compact version of the test case (getting rid of the
INTERFACE statement):


type t
  procedure(character), nopass, pointer :: ppc
end type
type(t),dimension(1) :: v
print *,v(1)%ppc()
end


Apparently the procedure pointer component must be CHARACTER-valued in order to
trigger the ICE. Also the object which the PPC is invoked on must be an array.


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
                   ` (2 preceding siblings ...)
  2010-12-13 16:57 ` janus at gcc dot gnu.org
@ 2010-12-13 17:39 ` janus at gcc dot gnu.org
  2010-12-13 19:18 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2010-12-13 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from janus at gcc dot gnu.org 2010-12-13 17:39:05 UTC ---
The ICE is fixed by the following patch:


Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c    (revision 167750)
+++ gcc/fortran/trans-expr.c    (working copy)
@@ -3594,7 +3594,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *

       if (!se->direct_byref)
     {
-      if (sym->attr.dimension || (comp && comp->attr.dimension))
+      if ((sym->attr.dimension && !comp) || (comp && comp->attr.dimension))
         {
           if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
         {


Will commit as obvious after bootstrapping.


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
                   ` (3 preceding siblings ...)
  2010-12-13 17:39 ` janus at gcc dot gnu.org
@ 2010-12-13 19:18 ` janus at gcc dot gnu.org
  2010-12-13 19:22 ` janus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2010-12-13 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from janus at gcc dot gnu.org 2010-12-13 19:18:08 UTC ---
Author: janus
Date: Mon Dec 13 19:17:46 2010
New Revision: 167767

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167767
Log:
2010-12-13  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/46201
    * trans-expr.c (gfc_conv_procedure_call): Handle procedure pointer
    components called on a dimensionful base object.

2010-12-13  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/46201
    * gfortran.dg/proc_ptr_comp_27.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_27.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
                   ` (4 preceding siblings ...)
  2010-12-13 19:18 ` janus at gcc dot gnu.org
@ 2010-12-13 19:22 ` janus at gcc dot gnu.org
  2010-12-13 21:39 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2010-12-13 19:22 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from janus at gcc dot gnu.org 2010-12-13 19:22:26 UTC ---
Fixed with r167767. Closing.

Thanks for the report!


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
                   ` (5 preceding siblings ...)
  2010-12-13 19:22 ` janus at gcc dot gnu.org
@ 2010-12-13 21:39 ` dominiq at lps dot ens.fr
  2010-12-13 21:51 ` janus at gcc dot gnu.org
  2010-12-13 22:13 ` dominiq at lps dot ens.fr
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2010-12-13 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-12-13 21:38:49 UTC ---
The tests in comments #2 and #3 compile now but segfault at run-time. Am I
right to say that they are invalid because the pointers point to nowhere?


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
                   ` (6 preceding siblings ...)
  2010-12-13 21:39 ` dominiq at lps dot ens.fr
@ 2010-12-13 21:51 ` janus at gcc dot gnu.org
  2010-12-13 22:13 ` dominiq at lps dot ens.fr
  8 siblings, 0 replies; 10+ messages in thread
From: janus at gcc dot gnu.org @ 2010-12-13 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from janus at gcc dot gnu.org 2010-12-13 21:51:49 UTC ---
(In reply to comment #7)
> The tests in comments #2 and #3 compile now but segfault at run-time. Am I
> right to say that they are invalid because the pointers point to nowhere?

Sure, they're not meant to be runtime tests.


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

* [Bug fortran/46201] [F03] ICE on procedure pointer component call
  2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
                   ` (7 preceding siblings ...)
  2010-12-13 21:51 ` janus at gcc dot gnu.org
@ 2010-12-13 22:13 ` dominiq at lps dot ens.fr
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2010-12-13 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-12-13 22:13:32 UTC ---
> Sure, they're not meant to be runtime tests.

I just wanted to be sure that I had understood the problem. Thanks


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

end of thread, other threads:[~2010-12-13 22:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-27 20:50 [Bug fortran/46201] New: ICE using procedure pointer sjbespa at comcast dot net
2010-10-27 21:48 ` [Bug fortran/46201] " burnus at gcc dot gnu.org
2010-10-27 22:03 ` [Bug fortran/46201] [F03] ICE on procedure pointer component call janus at gcc dot gnu.org
2010-12-13 16:57 ` janus at gcc dot gnu.org
2010-12-13 17:39 ` janus at gcc dot gnu.org
2010-12-13 19:18 ` janus at gcc dot gnu.org
2010-12-13 19:22 ` janus at gcc dot gnu.org
2010-12-13 21:39 ` dominiq at lps dot ens.fr
2010-12-13 21:51 ` janus at gcc dot gnu.org
2010-12-13 22:13 ` dominiq at lps dot ens.fr

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