Testsuite and constant-folding?

Brooks Moses brooks.moses@codesourcery.com
Fri Jan 5 18:41:00 GMT 2007


(Note: This issue came up in considering the Fortran testsuite, but I 
think it's sufficiently relevant to GCC as a whole (and I'm hoping for 
some comments from people familiar with the non-Fortran parts of GCC 
that it seemed reasonable to crosspost it.)


I've been recently poking at some bugs in Fortran's intrinsics 
(specifically, ISHFTC and IBCLR and the like), and one of the tricky 
bits is that there are two entirely separate code paths to consider -- 
there's the GMP-based one in gcc/fortran/simplify.c that does 
constant-folding, and there's the native-code one in libgfortran that 
does the runtime work.

However, as best I can tell, the relevant testcases completely ignore 
this issue, and thus end up only testing the constant-folding case. 
This strikes me as likely to be an endemic problem in the Fortran 
testsuite, and I would guess that substantial portions of libgfortran 
are not actually tested by "make check-fortran".

So, three questions:

(1) For a given Fortran testcase, is there a reliable way of ensuring 
that a given expression is not constant-folded and instead gets 
evaluated at runtime?

(2) Is there a way to turn off (essentially) all of the constant-folding 
machinery in a given compilation?

(3) How do GCC testsuites other than the Fortran one handle this issue?

I think that this is probably a significant enough issue that it would 
be worth implementing an option in the Fortran front end to turn off the 
majority (or even all) of the constant folding, and then adding a 
testsuite pass that uses this option.  Is there a relevant flag already 
present in GCC, or would we need to add one?  Thoughts on this proposal?

- Brooks



More information about the Fortran mailing list