This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42189] gfc_is_constant_expr has unacceptable side effects
- From: "jvdelisle at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Dec 2009 04:17:50 -0000
- Subject: [Bug fortran/42189] gfc_is_constant_expr has unacceptable side effects
- References: <bug-42189-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from jvdelisle at gcc dot gnu dot org 2009-12-05 04:17 -------
Studying this with a little instrumentation, I see that gfc_expand_constructor
is called only once with some of the test cases for pr20923. This is good.
Also, in the test case for pr41807, the work function constant_element does
nothing but check that the element is constant. In the patch for pr20923 I
will submit shortly, I have renamed it to is_constant_element which is clearer.
Moving on, the is_constant_element work function and the other constructor work
functions are called by expand_constructor. expand_constructor calls
gfc_simplify_expr. It is possible that gfc_simplify_expr is called more than
once on a given constructor expr as the various work functions are exercised. I
have not confirmed this. I wonder if it would make sense to add a flag to
gfc_expr to mark it as having been simplified already and do an early exit from
it for efficiency.
I will do some testing to see if it is indeed being called more than once and
report back.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42189