On Fri, Apr 10, 2020 at 8:27 AM Linus König <[hidden email]> wrote:
> I fixed the style issues. However, omitting the checks for NULL produced
> several regressions in my previous tests.
The style looks good. Please share testcases which exhibit the
regressions. They will also need to be included in
gcc/testsuite/gfortran.dg/ as part of the final commit. I am not aware
of a good source of documentation for writing the testcases
appropriate for DejaGnu, but you can examine other testcases to see
some examples. I can help you format the testcases as well. For the
final commit, a ChangeLog entry will also be necessary: take a look at
gcc/fortran/ChangeLog and match the format of previous entries. In
this case an entry for this patch might look something like this:
* resolve.c (resolve_fl_var_and_proc): Mark invalid array pointer
symbol with error.
* simplify.c (simplify_bound): Don't simplify if an error was
With this patch, I am not convinced that NULL components would be
handled properly. It appears that if array is NULL, the new check will
not pass and the next line "array->ts.type == BT_CLASS" will segfault.
If array->symtree is NULL and the next two checks for BT_CLASS and
EXPR_VARIABLE do not pass, then the line "as = array->symtree->n.sym"
will segfault. Perhaps seeing the relevant testcases will clarify the
conditions which this patch covers.
If you believe the NULL guards are required, please consider the
following replacement for the code in simplify_bound, which would
protect the surrounding code as well:
+ if (!array->symtree)
+ return NULL;
+ /* Do not attempt to resolve if error has already been issued. */
+ array_sym = array->symtree->n.sym;
+ if (!array_sym || array_sym->error)
+ return NULL;
/* Follow any component references. */
- as = array->symtree->n.sym->as;
+ as = array_sym->as;
for (ref = array->ref; ref; ref = ref->next)