https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79524

--- Comment #28 from Christopher Albert <albert at tugraz dot at> ---
Verified: unpatched trunk shows 43 'Invalid read' under valgrind when compiling
fimplicit_none_2.f90 *without* -fimplicit-none (the path that reaches the
charlen bug).  With -fimplicit-none, 'n' is rejected earlier as 'Scalar
INTEGER expression expected' before any charlen is created, so valgrind
stays clean -- that is why the existing testsuite run of fimplicit_none_2.f90
(which does pass -fimplicit-none) never caught this.

With the patch applied, all 43 invalid reads disappear.

The new testcase pr79524.f90 deliberately omits -fimplicit-none so that it
exercises the actual bug path.  It uses MALLOC_PERTURB_=165 to make the
freed-memory access deterministically crash without needing an ASan or
valgrind build.

Reply via email to