Hi Andre,

Am 22.04.25 um 15:07 schrieb Andre Vehreschild:
Hi all,

attached patch fixes an illegal use of gfc_current_locus during the
check()-phase of several coarray functions. Instead gfc_current_intrinsic_where
needs to be used.

this is bordering on the obvious and thus OK, except for:

@@ -6967,7 +6972,8 @@ gfc_check_ucobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
 {
   if (flag_coarray == GFC_FCOARRAY_NONE)
     {
- gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable"); + gfc_fatal_error ("Coarrays disabled at L, use %<-fcoarray=%> to enable",
+                      gfc_current_intrinsic_where);
       return false;
     }

A percent is missing.  It should read "%L", not "L".

This error does not crash gfortran reliably. But valgrind
reports an access to uninitialized memory. I therefore do not know how to test
this in the testsuite.

I don't know a reasonable way to test this either.  There is one
existing test with dg-error "Coarrays disabled..., but the issue
addressed here might show up only in an instrumented compiler
(ASAN or UBSAN?).  And since each message here is emitted by
gfc_fatal_error(), one could only test one case per testcase.
(IMHO testing this would be insane.)

Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline?

Yes, this is OK.  Thanks for the patch!

Harald

Regards,
        Andre


Reply via email to