https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80751
--- Comment #2 from Vittorio Zecca <zeccav at gmail dot com> ---
I found that at trans-stmt.c:455 a NULL pointer is being dereferenced
at line 455
compiling test case gfortran.dg/bounds_check_fail_2.f90 and others.
This is the code fragment:
gfc_conv_ss_startstride (&loop);
/* TODO: gfc_conv_loop_setup generates a temporary for vector
subscripts. This could be prevented in the elemental case
as temporaries are handled separatedly
(below in gfc_conv_elemental_dependencies). */
gfc_conv_loop_setup (&loop, &code->expr1->where); /* NULL
dereferencing here*/
gfc_mark_ss_chain_used (ss, 1);
So I put a gcc_assert before as in:
gfc_conv_ss_startstride (&loop);
/* TODO: gfc_conv_loop_setup generates a temporary for vector
subscripts. This could be prevented in the elemental case
as temporaries are handled separatedly
(below in gfc_conv_elemental_dependencies). */
gcc_assert(code->expr1);/*!vz gfortran.dg/bounds_check_fail_2.f90*/
gfc_conv_loop_setup (&loop, &code->expr1->where);
gfc_mark_ss_chain_used (ss, 1);
On my test case, and several more, the gcc_assert fails thus confirming that
pointer code->expr1 is NULL but it is dereferenced in the second
argument of gfc_conv_loop_setup.
I hope it is clear now.
So the compiler fails not on calling an elemental procedure, but while
compiling
the call to an elemental procedure.
I am sorry if I was obscure before.