On 06/25/2012 06:39 AM, Jakub Jelinek wrote:
On Thu, Jun 21, 2012 at 12:34:32AM -0700, Jason Merrill wrote:
All the tests in the libgomp and gcc testsuites pass with this
patch, but I'm not very confident about it because I don't fully
understand what the code is doing. In particular, I'm not sure what
the condition controlling the code in tsubst_omp_for_iterator that
looks at the clauses should be; init can never be a DECL_EXPR at
that point anymore.
Don't remember exactly, but I'd guess I wanted to preserve as much as
possible what the code was doing before for the non-class types.
After RECUR init can't be DECL_EXPR, right? So if you do it unconditionally
it doesn't need to be handled.
Right, I just wasn't sure what the point of the test was. Is it that if
we're declaring the iteration variable in the for-init-statement, we
don't need to worry about making it OMP private?
I'm also not sure whether moving the begin_omp_structured_block is
necessary, but it seemed like a good idea since we're handling the
DECL_EXPR earlier.
Looking at the code now, I wonder whether begin_omp_structured_block
shouldn't be moved later, not earlier, because the decl ctors should happen
before the body of the worksharing region.
Should they? It seems that each of the private copies of the decl gets
initialized separately, which I would expect to be part of the
worksharing region.
Jason