public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42597]  New: ICE with procedure pointer initialized to null()
@ 2010-01-03 17:43 mrestelli at gmail dot com
  2010-01-04  9:55 ` [Bug fortran/42597] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mrestelli at gmail dot com @ 2010-01-03 17:43 UTC (permalink / raw)
  To: gcc-bugs

The attached code (which seems fine to me) produces an internal
compiler error.

gfortran -c pp.f90 -o pp.o
f951: internal compiler error: in gfc_build_null_descriptor, at
fortran/trans-array.c:372

gfortran --version
GNU Fortran (GCC) 4.5.0 20091229 (experimental)


module mod_a
 implicit none
 public :: p_fun
 private

 abstract interface
  pure function intf(x) result(y)
   real, intent(in) :: x(:,:)
   real :: y(size(x,1),size(x,1),size(x,2))
  end function intf
 end interface

 !procedure(intf), pointer :: p_fun ! this works
 procedure(intf), pointer :: p_fun => null()

end module mod_a


-- 
           Summary: ICE with procedure pointer initialized to null()
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrestelli at gmail dot com
 GCC build triplet: GNU Fortran (GCC) 4.5.0 20091229 (experimental)
  GCC host triplet: Linux 2.6.27-gentoo-r8 x86_64 AMD Turion(tm) 64 Mobile
                    Technolog


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


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

* [Bug fortran/42597] ICE with procedure pointer initialized to null()
  2010-01-03 17:43 [Bug fortran/42597] New: ICE with procedure pointer initialized to null() mrestelli at gmail dot com
@ 2010-01-04  9:55 ` burnus at gcc dot gnu dot org
  2010-01-04 11:33 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-04  9:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2010-01-04 09:55 -------
Confirmed. The initialization works - if in a procedure or program, but it
fails in the declaration part of a module.

The problem seems to be related to returning an array - one should not have
called gfc_build_null_descriptor but via get_proc_pointer_decl the routine
gfc_conv_initializer (with pointer = true and array = false).

Actually, the following looks bogus:

      DECL_INITIAL (decl) = gfc_conv_initializer (sym->value, &sym->ts,
          TREE_TYPE (decl), sym->attr.dimension, sym->attr.proc_pointer);

Namely, the last but one argument. I think, it should be:
  sym->attr.proc_pointer ? false : sym->attr.dimension
But that does not explain why it seems to work elsewhere.

Janus, what do you think?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-04 09:55:26
               date|                            |


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


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

* [Bug fortran/42597] ICE with procedure pointer initialized to null()
  2010-01-03 17:43 [Bug fortran/42597] New: ICE with procedure pointer initialized to null() mrestelli at gmail dot com
  2010-01-04  9:55 ` [Bug fortran/42597] " burnus at gcc dot gnu dot org
@ 2010-01-04 11:33 ` burnus at gcc dot gnu dot org
  2010-01-07  8:12 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-04 11:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-01-04 11:33 -------
(In reply to comment #1)
> Confirmed. The initialization works - if in a procedure or program, but it
> fails in the declaration part of a module.

Actually, it also fails there; it only succeeded because the (unused)
declaration
was optimized away before reaching the line of interest.

I am now testing my patch - looks OK so far.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-04 09:55:26         |2010-01-04 11:33:10
               date|                            |


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


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

* [Bug fortran/42597] ICE with procedure pointer initialized to null()
  2010-01-03 17:43 [Bug fortran/42597] New: ICE with procedure pointer initialized to null() mrestelli at gmail dot com
  2010-01-04  9:55 ` [Bug fortran/42597] " burnus at gcc dot gnu dot org
  2010-01-04 11:33 ` burnus at gcc dot gnu dot org
@ 2010-01-07  8:12 ` burnus at gcc dot gnu dot org
  2010-01-07  8:13 ` burnus at gcc dot gnu dot org
  2010-02-07  4:03 ` hjl dot tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-07  8:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2010-01-07 08:12 -------
Subject: Bug 42597

Author: burnus
Date: Thu Jan  7 08:12:10 2010
New Revision: 155688

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155688
Log:
2010-01-07  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42597
        * trans-decl.c (get_proc_pointer_decl): Fix call to
        gfc_conv_initializer for array-valued proc-pointer funcs.

2010-01-07  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42597
        * gfortran.dg/proc_ptr_26.f90: New test.


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


-- 


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


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

* [Bug fortran/42597] ICE with procedure pointer initialized to null()
  2010-01-03 17:43 [Bug fortran/42597] New: ICE with procedure pointer initialized to null() mrestelli at gmail dot com
                   ` (2 preceding siblings ...)
  2010-01-07  8:12 ` burnus at gcc dot gnu dot org
@ 2010-01-07  8:13 ` burnus at gcc dot gnu dot org
  2010-02-07  4:03 ` hjl dot tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-07  8:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2010-01-07 08:13 -------
FIXED on the trunk (4.5).

Thanks for reporting the bug!


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

* [Bug fortran/42597] ICE with procedure pointer initialized to null()
  2010-01-03 17:43 [Bug fortran/42597] New: ICE with procedure pointer initialized to null() mrestelli at gmail dot com
                   ` (3 preceding siblings ...)
  2010-01-07  8:13 ` burnus at gcc dot gnu dot org
@ 2010-02-07  4:03 ` hjl dot tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-07  4:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|GNU Fortran (GCC) 4.5.0     |
                   |20091229 (experimental)     |
   GCC host triplet|Linux 2.6.27-gentoo-r8      |
                   |x86_64 AMD Turion(tm) 64    |
                   |Mobile Technolog            |
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2010-02-07  4:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-03 17:43 [Bug fortran/42597] New: ICE with procedure pointer initialized to null() mrestelli at gmail dot com
2010-01-04  9:55 ` [Bug fortran/42597] " burnus at gcc dot gnu dot org
2010-01-04 11:33 ` burnus at gcc dot gnu dot org
2010-01-07  8:12 ` burnus at gcc dot gnu dot org
2010-01-07  8:13 ` burnus at gcc dot gnu dot org
2010-02-07  4:03 ` hjl dot tools at gmail dot com

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