select type failure?
Andrew Benson
abenson@its.caltech.edu
Wed Feb 16 07:08:00 GMT 2011
The attached code produces unexpected behavior (and a segfault) when compiled
using gfortran 4.6 r170207:
$ gfortran test.F90 -o test.exe -g -fbacktrace
$ test.exe
incorrect
Program received signal 11 (SIGSEGV): Segmentation fault.
Backtrace for this error:
+ [0x40000420]
+ function __tree_nodes_MOD_merger_tree_construction_walk (0x80486F3)
at line 24 of file test.F90
+ function __merger_tree_build_MOD_merger_tree_build_do (0x804877D)
at line 65 of file test.F90
+ function test (0x80487ED)
at line 78 of file test.F90
+ /lib/libc.so.6(__libc_start_main+0xdc) [0x24be9c]
Assuming that my code is valid (it is as far as I can tell, but if not I'd be
happy to hear what I'm doing wrong) then I would expect the "select type"
construct to execute the contents of the "type is (treeNode)" block and not
the "class default" block. As a result of it failing to do this the workNode
pointer is unassigned and then causes a segfault when I try to access
workNode%childNode
I've attempted to reduce the code further, but began running into other
complaints from the compiler, e.g.:
undefined reference to `__merger_tree_build_MOD___vtab_tree_nodes_Treenode'
so I figured I'd stop and double check that this is an actual compiler bug
before going any further.
Thanks,
Andrew.
--
* Andrew Benson: http://www.tapir.caltech.edu/~abenson/contact.html
* Galacticus: http://sites.google.com/site/galacticusmodel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.F90
Type: text/x-fortran
Size: 2233 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110216/976b2d50/attachment.bin>
More information about the Fortran
mailing list