This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix !$omp end .... symbols handling


On Thu, Feb 16, 2006 at 05:38:51PM +0100, Tobias.Schlueter@Physik.Uni-Muenchen.DE wrote:
> Quoting Jakub Jelinek <jakub@redhat.com>:
> > As shown on the attached testcase, if variable list was on the
> > !$omp end directive and contained a reference to a symbol that
> > hasn't been referenced before at all, following reject_statement
> > would free the symbols, eventhough they were listed in omp_clauses,
> > so we would then dereference freed memory (or worse reused for something
> > else).  The *_OMP_END_* statements aren't accepted, because omp_clauses
> > are always attached to the matching starting omp directive.
> > Tested on x86_64-linux.
> 
> Why not mark the symbol as referenced when parsing the OMP directive?

I do that
      m = gfc_match_symbol (&sym, 1);
      switch (m)
        {
        case MATCH_YES:
          gfc_set_sym_referenced (sym);
but that is apparently not enough.  All symbols need to be either committed
or undone.  Or do you think I should call gfc_commit_symbol (sym); on each
symbol as well?  As the starting omp directives are known to call
gfc_commit_symbols (); at the end if they are parsed properly, that
sounds like an overkill.  Plus, if parsing of the starting or end omp
directives fails, I guess the symbols can be safely undone, their addresses
aren't stored anywhere.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]