]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: Use correct location in check of coarray functions [PR119200]
authorAndre Vehreschild <vehre@gcc.gnu.org>
Tue, 22 Apr 2025 08:11:52 +0000 (10:11 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Wed, 23 Apr 2025 07:46:16 +0000 (09:46 +0200)
Use gfc_current_intrinsic_where during check(), because
gfc_current_locus is not set to correct location or at all.

PR fortran/119200

gcc/fortran/ChangeLog:

* check.cc (gfc_check_lcobound): Use locus from intrinsic_where.
(gfc_check_image_index): Same.
(gfc_check_num_images): Same.
(gfc_check_team_number): Same.
(gfc_check_this_image): Same.
(gfc_check_ucobound): Same.

gcc/fortran/check.cc

index 356e0d7f678ce4992f5eac4e510f1549cb0be444..299c216cf36c070badeb05b4dd3abcc02b5245bc 100644 (file)
@@ -3835,7 +3835,8 @@ gfc_check_lcobound (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;
     }
 
@@ -6572,7 +6573,8 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub,
 
   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;
     }
 
@@ -6622,7 +6624,8 @@ gfc_check_num_images (gfc_expr *team_or_team_number)
 {
   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;
     }
 
@@ -6651,7 +6654,8 @@ gfc_check_team_number (gfc_expr *team)
 {
   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;
     }
 
@@ -6668,7 +6672,8 @@ gfc_check_this_image (gfc_actual_arglist *args)
 
   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;
     }
 
@@ -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;
     }