public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, Fortran, v1] Clarify error message of co_reduce
@ 2017-10-27 10:32 Andre Vehreschild
  2017-10-27 14:31 ` Steve Kargl
  2017-10-28 17:11 ` Andre Vehreschild
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Vehreschild @ 2017-10-27 10:32 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

Hi all,

as noted on IRC is one of the error message in check.c co_reduce misleading.
The attached patch fixes this. The intention of the error message is to tell
that the type of the argument bound to parameter A is of wrong type and not
that an unspecific argument has a wrong type.

If no one objects within 24 h I am planning to commit this patch as obvious to
trunk gcc-7. Bootstrapped and regtested on x86_64-linux-gnu/f25.

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: co_reduce_error_msg_fix.clog --]
[-- Type: text/plain, Size: 134 bytes --]

gcc/fortran/ChangeLog:

2017-10-27  Andre Vehreschild  <vehre@gcc.gnu.org>

	* check.c (gfc_check_co_reduce): Clarify error message.


[-- Attachment #3: co_reduce_error_msg_fix.diff --]
[-- Type: text/x-patch, Size: 573 bytes --]

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 681950e..759c15a 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -1731,7 +1731,7 @@ gfc_check_co_reduce (gfc_expr *a, gfc_expr *op, gfc_expr *result_image,
 
   if (!gfc_compare_types (&a->ts, &sym->result->ts))
     {
-      gfc_error ("A argument at %L has type %s but the function passed as "
+      gfc_error ("The A argument at %L has type %s but the function passed as "
 		 "OPERATOR at %L returns %s",
 		 &a->where, gfc_typename (&a->ts), &op->where,
 		 gfc_typename (&sym->result->ts));

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, Fortran, v1] Clarify error message of co_reduce
  2017-10-27 10:32 [PATCH, Fortran, v1] Clarify error message of co_reduce Andre Vehreschild
@ 2017-10-27 14:31 ` Steve Kargl
  2017-10-28 17:11 ` Andre Vehreschild
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2017-10-27 14:31 UTC (permalink / raw)
  To: Andre Vehreschild; +Cc: GCC-Patches-ML, GCC-Fortran-ML

On Fri, Oct 27, 2017 at 12:19:02PM +0200, Andre Vehreschild wrote:
> Hi all,
> 
> as noted on IRC is one of the error message in check.c co_reduce misleading.
> The attached patch fixes this. The intention of the error message is to tell
> that the type of the argument bound to parameter A is of wrong type and not
> that an unspecific argument has a wrong type.
> 
> If no one objects within 24 h I am planning to commit this patch as obvious to
> trunk gcc-7. Bootstrapped and regtested on x86_64-linux-gnu/f25.
> 
> Regards,
> 	Andre
> -- 
> Andre Vehreschild * Email: vehre ad gmx dot de 

> gcc/fortran/ChangeLog:
> 
> 2017-10-27  Andre Vehreschild  <vehre@gcc.gnu.org>
> 
> 	* check.c (gfc_check_co_reduce): Clarify error message.
> 

> diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
> index 681950e..759c15a 100644
> --- a/gcc/fortran/check.c
> +++ b/gcc/fortran/check.c
> @@ -1731,7 +1731,7 @@ gfc_check_co_reduce (gfc_expr *a, gfc_expr *op, gfc_expr *result_image,
>  
>    if (!gfc_compare_types (&a->ts, &sym->result->ts))
>      {
> -      gfc_error ("A argument at %L has type %s but the function passed as "
> +      gfc_error ("The A argument at %L has type %s but the function passed as "
>  		 "OPERATOR at %L returns %s",
>  		 &a->where, gfc_typename (&a->ts), &op->where,
>  		 gfc_typename (&sym->result->ts));

Andre,

Can I suggest that you take a look at scalar_check in check.c
and use a similar approach for your error message?

gfc_error ("%qs argument of %qs intrinsics at %L has type %s but "
	"the function passed as OPERATOR at %L returns %s",
    gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,
    &a->where, gfc_typename (&a->ts), &op->where,
    gfc_typename (&sym->result->ts));

Note, you'll need to use the correct index in gfc_current...arg[0]->name.
Also note, %qs gives a 'quoted' string, which in my xterm is a boldface
font.



-- 
Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, Fortran, v1] Clarify error message of co_reduce
  2017-10-27 10:32 [PATCH, Fortran, v1] Clarify error message of co_reduce Andre Vehreschild
  2017-10-27 14:31 ` Steve Kargl
@ 2017-10-28 17:11 ` Andre Vehreschild
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Vehreschild @ 2017-10-28 17:11 UTC (permalink / raw)
  To: GCC-Patches-ML, GCC-Fortran-ML

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Hi all,

I got no direct objections therefore committed as r254197 to trunk and r254198
to gcc-7. 

@Steve, I will take a look at what you pointed. 

- Andre

On Fri, 27 Oct 2017 12:19:02 +0200
Andre Vehreschild <vehre@gmx.de> wrote:

> Hi all,
> 
> as noted on IRC is one of the error message in check.c co_reduce misleading.
> The attached patch fixes this. The intention of the error message is to tell
> that the type of the argument bound to parameter A is of wrong type and not
> that an unspecific argument has a wrong type.
> 
> If no one objects within 24 h I am planning to commit this patch as obvious to
> trunk gcc-7. Bootstrapped and regtested on x86_64-linux-gnu/f25.
> 
> Regards,
> 	Andre


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 

[-- Attachment #2: submit.diff --]
[-- Type: text/x-patch, Size: 919 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 254196)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@
+2017-10-28  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* check.c (gfc_check_co_reduce): Clarify error message.
+
 2017-10-28  Paul Thomas  <pault@gcc.gnu.org>
 
 	PR fortran/81758
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c	(Revision 254196)
+++ gcc/fortran/check.c	(Arbeitskopie)
@@ -1731,7 +1731,7 @@
 
   if (!gfc_compare_types (&a->ts, &sym->result->ts))
     {
-      gfc_error ("A argument at %L has type %s but the function passed as "
+      gfc_error ("The A argument at %L has type %s but the function passed as "
 		 "OPERATOR at %L returns %s",
 		 &a->where, gfc_typename (&a->ts), &op->where,
 		 gfc_typename (&sym->result->ts));

[-- Attachment #3: submit-7.diff --]
[-- Type: text/x-patch, Size: 924 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 254197)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,7 @@
+2017-10-28  Andre Vehreschild  <vehre@gcc.gnu.org>
+
+	* check.c (gfc_check_co_reduce): Clarify error message.
+
 2017-10-28  Paul Thomas  <pault@gcc.gnu.org>
 
 	Backported from trunk
Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c	(Revision 254197)
+++ gcc/fortran/check.c	(Arbeitskopie)
@@ -1731,7 +1731,7 @@
 
   if (!gfc_compare_types (&a->ts, &sym->result->ts))
     {
-      gfc_error ("A argument at %L has type %s but the function passed as "
+      gfc_error ("The A argument at %L has type %s but the function passed as "
 		 "OPERATOR at %L returns %s",
 		 &a->where, gfc_typename (&a->ts), &op->where,
 		 gfc_typename (&sym->result->ts));

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-28 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-27 10:32 [PATCH, Fortran, v1] Clarify error message of co_reduce Andre Vehreschild
2017-10-27 14:31 ` Steve Kargl
2017-10-28 17:11 ` Andre Vehreschild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).