Re: Patch to enable unlimited polymorphism to gfortran

2012-12-20 Thread Dominique Dhumieres
Dear Paul, Apparently you have forgotten to commit the update for same_type_as_1.f03. Dominique

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-19 Thread Paul Richard Thomas
Dear All, Committed as revision 194622 and corrigendum 194626 (removes one test from unlimited_polymorphic_2.f03). Thanks to one and all for the help. Paul On 19 December 2012 07:17, Paul Richard Thomas wrote: > Thanks Tobias and Dominique, > > I'll make the corrections that you have request

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-18 Thread Paul Richard Thomas
Thanks Tobias and Dominique, I'll make the corrections that you have requested. I believe that the 2*(GFC_MAX_SYMBOL_LEN+1) has a historic origin - I had not thought about it until last night, when you pointed it out. As for the segfault - that line should go. The automatic nulling of the _vptr

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-18 Thread Dominique Dhumieres
Dear Paul, With your patch applied on top of a clean revision 194590, the executable for unlimited_polymorphic_1.f03 gives a Segmentation fault - invalid memory reference at Program received signal SIGSEGV, Segmentation fault. 0x00011d1c in MAIN__ () at /opt/gcc/p_work/gcc/testsuite/gfo

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-18 Thread Tobias Burnus
Paul Richard Thomas wrote: Please find attached an updated version of the patch, which I believe answers your comments/objections. Thanks for the patch. They patch is OK from my side, if you address the issues below. + /* Assign a hash value for an intrinsic type. The algorithm is that of S

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-16 Thread Tobias Burnus
Paul Richard Thomas wrote: The problem is with the way in which extends_type_of is organised. It takes the _vptr directly. Unless it is null for undefined pointers, a segfault is triggered. So what? If I have: integer, pointer :: ptr ptr = 5 will also lead to a segfault (or a bus error);

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-16 Thread Paul Richard Thomas
Hi Tobias, The problem is with the way in which extends_type_of is organised. It takes the _vptr directly. Unless it is null for undefined pointers, a segfault is triggered. I guess that I could achieve the same thing with the default initialization. Initialization of class(*) pointers appears

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-16 Thread Tobias Burnus
Paul Richard Thomas wrote: + /* Unlimited polymorphic pointers should have their vptr nullified. */ >+ if (UNLIMITED_POLY (sym) && CLASS_DATA (sym)->attr.pointer) >+gfc_defer_symbol_init (sym); > > >Why? If the pointer has never been pointer-associated, one shouldn't access It's so that S

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-16 Thread Paul Richard Thomas
Dear Tobias, Up front, thanks for this initial feedback. Dominique informed me on #gfortran that "the patch works as advertised". ...snip... > Running your test cases through crayftn, I found: > > if (SAME_TYPE_AS (obj1, u1) .neqv. .FALSE.) call abort > ^ > ftn-1698 c

Re: Patch to enable unlimited polymorphism to gfortran

2012-12-16 Thread Tobias Burnus
Thanks for the patch, here is a first but incomplete review. I think the patch looks mostly okay. Running your test cases through crayftn, I found: if (SAME_TYPE_AS (obj1, u1) .neqv. .FALSE.) call abort ^ ftn-1698 crayftn: ERROR $MAIN, File = unlimited_polymorphic_1