[Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-05 Thread Tobias Burnus
gfortran supports OPTIONAL since quite some time - also some more complicated cases involving ELEMENTAL or the new F2008 addition, but as testing showed, the support is still incomplete; especially with polymorphic arguments there were several bugs. Besides a simple absent argument, passing an

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-07 Thread Dominique Dhumieres
Hi Tobias, I have tested your patch, mostly the added test cases. I think the test gfortran.dg/class_optional_2.f90 should be split: it has too much tests lumped together. In addition the test gfortran.dg/class_optional_1.f90 does not compile because "symbol 'i' at (1) has no IMPLICIT type" (three

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-11 Thread Janus Weil
Hi Tobias, > gfortran supports OPTIONAL since quite some time - also some more > complicated cases involving ELEMENTAL or the new F2008 addition, but as > testing showed, the support is still incomplete; especially with polymorphic > arguments there were several bugs. > > Besides a simple absent a

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-16 Thread Tobias Burnus
Hi Dominique, Dominique Dhumieres wrote: the test gfortran.dg/class_optional_1.f90 does not compile ... but the code seems weird. I concur – and believe that it is already covered by the other test cases. Thus, I removed it. The code gfortran.dg/class_optional_2.f90 compiles, but the ru

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-16 Thread Janus Weil
Hi Tobias, >> + for (ref = e->ref; ref; ref = ref->next) >> +{ >> + if (ref->type == REF_COMPONENT >> + && ref->u.c.component->ts.type == BT_CLASS) >> + class_ref = ref; >> + >> + if (ref->next == NULL) >> + break; >> +} >> >> ... I guess the last if statem

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-16 Thread Dominique Dhumieres
Hi Tobias, I did not yet appied you latest patch to gfortran, but I ran the new tests with gfortran patched with the previous patch and both pass (manual testing without option, but -fcoarray=single). Note that for class_optional_1.f90, valgrind --leak-check=full gives ==45665== 4 bytes in 1 bloc

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-16 Thread Dominique Dhumieres
Tobias, The previous class_optional_2.f90 runs after your commit, but it takes ~168s (so it may have run with the previous patch also, but I was not patient enough to see it). The culprits are given by the following profile: + 100.0%, start, a.out | + 100.0%, main, a.out | | + 100.0%, MAIN__, a.o

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-16 Thread Tobias Burnus
Dominique, Dominique Dhumieres wrote: The previous class_optional_2.f90 runs after your commit, but it takes ~168s (so it may have run with the previous patch also, but I was not patient enough to see it). Here, it takes (current version) < 2s to compile and 0.150s to run the program. If I lo

Re: [Patch, Fortran] Fix OPTIONAL, esp. with polymorphism

2012-10-16 Thread Dominique Dhumieres
> Can you confirm that the class_optional_1.f90 of the trunk works correctly? Yes: I have regtested with make -k check-gfortran RUNTESTFLAGS="dg.exp=class_optional* --target_board=unix'{-m32,-m64}'" without failures. The profile I have posted was for the former version of class_optional_2.f90.