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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-09-04 
21:19:31 UTC ---
I think one problem is that
  ! { dg-additional-sources class_45a.f03 }
compiles the additional source *after* the main file. That's not trivially
fixable as the library part of $options needs to come after the files - thus,
one would need a new global variable, which is then used before $file in the
compiler execution.


(In reply to comment #4)
> > An evil trick would be the following, which causes a run once: ...

A better way is the following patch, which adds "dg-do run-once", which should
then also be applied to cray_pointers_2.f90. I think a "dg-do run-once" is also
useful to tests of libgfortran for which running a test case multiple times is
just a waste for time. One still should add a comment in class_45{a,b}.f90 to
denote this nonobvious file dependency.


--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -104,7 +104,9 @@ proc gfortran-dg-runtest { testcases default-extra-flags }
{

        # look if this is dg-do-run test, in which case
        # we cycle through the option list, otherwise we don't
-       if [expr [search_for $test "dg-do run"]] {
+       if [expr [search_for $test "dg-do +run-once"]] {
+           set option_list [list { -O } ]
+       } elseif [expr [search_for $test "dg-do +run"]] {
            set option_list $torture_with_loops
        } else {
            set option_list [list { -O } ]

Reply via email to