[Bug libfortran/46611] New: call to abstract class procedure segmentation fault

leonard.lopes at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 22 20:27:00 GMT 2010


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

           Summary: call to abstract class procedure segmentation fault
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: leonard.lopes@gmail.com


# the exact version of GCC;
# the system type;
# the options given when GCC was configured/built;

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/4.6.0/lto-wrapper
Target: i386-apple-darwin9.8.0
Configured with: ./configure : (reconfigured) ./configure
--enable-languages=c,c++,fortran,java,lto,objc --no-create --no-recursion
Thread model: posix
gcc version 4.6.0 20101115 (experimental) (GCC) 


# the complete command line that triggers the bug;

called by:
gfortran -v -O0 -Wall -trackback

# the compiler output (error messages, warnings, etc.); and

NONE

# the preprocessed file (*.i*) that triggers the bug

I have tried to add the -save-temps command so I can provide you with some
information, but all I get are many many .s files.  No .i files.

# Summary

I use many classes and extension in a code I am developing (in Fortran 2003). 
Rather large project, over 200 thousand lines long, mostly restricted code. 
Only the front end is Fortran 2003, most of the code is legacy F77 code.  I use
deferred procedures in a base class and develop several extensions.  I
frequency only use 1 or 2 levels of abstraction.

The bug I am hitting is when an extension of a class calls a function that is
defined in the class.  An example is below.


module AModule
  class, abstract :: A
  contains
    procedure, public, pass :: sub
  end class 
contains
  subroutine sub(this)
  end subroutine
end module

module BModule
  use AModule
  class, extend(A) :: B
    ...
  end class
end BModule

program prog
  use BModule
  type(B) :: x

  call x%sub()

end program prog

This code compiles fine, but when the subroutine is called in the program the
code hangs.  The above code WILL NOT reproduce the bug.  What is really
confusing is that this type of scenario (abstract class + extensions) happens
all the time in the code I am developing, works correct, and does not hang. 
However, in this one piece of code I have written it does not.  I have tried
moving the subroutine to the extended class and declaring the function deferred
but that still does not work.

As I said above, I tried to generate the .i files for the debuggers but was
unable.  Please contact me for more information or some files.



More information about the Gcc-bugs mailing list