diff mbox

[Fortran] Correct declaration of frexp and friends

Message ID 4D9AE3C2.5020300@free.fr
State New
Headers show

Commit Message

Duncan Sands April 5, 2011, 9:41 a.m. UTC
Hi Tobias,

> I do, so that's not a problem. By the way I just noticed that the arguments to
> the scalbn functions also seem to be the wrong way round:

here's a gcc-4.5 patch which fixes: (1) the comment for fntype[2], (2) the
prototypes for the frexp family and (3) the prototypes for the scalbn family.
I checked all uses of all of the function types declared here and all the rest
seem to be correct.  I also took a look at an example using scalbn and it looks
like calls to scalbn pass arguments in the right order (i.e. consistent with the
fixed prototype).  I'm running the testsuite now.  OK to apply to the 4.5 branch
if it passes testing?

Comments

Tobias Burnus April 5, 2011, 10:01 a.m. UTC | #1
Hi Ducan,

On 04/05/2011 11:41 AM, Duncan Sands wrote:
>> By the way I just noticed that the arguments to
>> the scalbn functions also seem to be the wrong way round:
>
> here's a gcc-4.5 patch which fixes: (1) the comment for fntype[2], (2) 
> the
> prototypes for the frexp family and (3) the prototypes for the scalbn 
> family.
> I checked all uses of all of the function types declared here and all 
> the rest
> seem to be correct.  I also took a look at an example using scalbn and 
> it looks
> like calls to scalbn pass arguments in the right order (i.e. 
> consistent with the
> fixed prototype).  I'm running the testsuite now.  OK to apply to the 
> 4.5 branch
> if it passes testing?

OK. (Contrary to the now fixed frexp, it seems to only affect < 4.6.)

Thanks for checking and fixing these bugs!

Tobias

> Index: f95-lang.c
> ===================================================================
> --- f95-lang.c    (revision 171972)
> +++ f95-lang.c    (working copy)
> @@ -646,19 +646,20 @@
>    /* type (*) (type, type) */
>    tmp = tree_cons (NULL_TREE, type, tmp);
>    fntype[1] = build_function_type (type, tmp);
> -  /* type (*) (int, type) */
> +  /* type (*) (type, int) */
>    tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
>    tmp = tree_cons (NULL_TREE, type, tmp);
>    fntype[2] = build_function_type (type, tmp);
>    /* type (*) (void) */
>    fntype[3] = build_function_type (type, void_list_node);
>    /* type (*) (type, &int) */
> -  tmp = tree_cons (NULL_TREE, type, void_list_node);
> -  tmp = tree_cons (NULL_TREE, build_pointer_type (integer_type_node), 
> tmp);
> +  tmp = tree_cons (NULL_TREE, build_pointer_type (integer_type_node),
> +                   void_list_node);
> +  tmp = tree_cons (NULL_TREE, type, tmp);
>    fntype[4] = build_function_type (type, tmp);
>    /* type (*) (type, int) */
> -  tmp = tree_cons (NULL_TREE, type, void_list_node);
> -  tmp = tree_cons (NULL_TREE, integer_type_node, tmp);
> +  tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
> +  tmp = tree_cons (NULL_TREE, type, tmp);
>    fntype[5] = build_function_type (type, tmp);
>  }
>
>
Duncan Sands April 5, 2011, 11:07 a.m. UTC | #2
Hi Tobias,

>> here's a gcc-4.5 patch which fixes: (1) the comment for fntype[2], (2) the
>> prototypes for the frexp family and (3) the prototypes for the scalbn family.
>> I checked all uses of all of the function types declared here and all the rest
>> seem to be correct. I also took a look at an example using scalbn and it looks
>> like calls to scalbn pass arguments in the right order (i.e. consistent with the
>> fixed prototype). I'm running the testsuite now. OK to apply to the 4.5 branch
>> if it passes testing?
>
> OK. (Contrary to the now fixed frexp, it seems to only affect < 4.6.)

yes, scalbn was already fixed in gcc-4.6 and later.

> Thanks for checking and fixing these bugs!

No problem, thanks for approving!  Committed as revision 171979.

Ciao, Duncan.
diff mbox

Patch

Index: f95-lang.c
===================================================================
--- f95-lang.c	(revision 171972)
+++ f95-lang.c	(working copy)
@@ -646,19 +646,20 @@ 
    /* type (*) (type, type) */
    tmp = tree_cons (NULL_TREE, type, tmp);
    fntype[1] = build_function_type (type, tmp);
-  /* type (*) (int, type) */
+  /* type (*) (type, int) */
    tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
    tmp = tree_cons (NULL_TREE, type, tmp);
    fntype[2] = build_function_type (type, tmp);
    /* type (*) (void) */
    fntype[3] = build_function_type (type, void_list_node);
    /* type (*) (type, &int) */
-  tmp = tree_cons (NULL_TREE, type, void_list_node);
-  tmp = tree_cons (NULL_TREE, build_pointer_type (integer_type_node), tmp);
+  tmp = tree_cons (NULL_TREE, build_pointer_type (integer_type_node),
+                   void_list_node);
+  tmp = tree_cons (NULL_TREE, type, tmp);
    fntype[4] = build_function_type (type, tmp);
    /* type (*) (type, int) */
-  tmp = tree_cons (NULL_TREE, type, void_list_node);
-  tmp = tree_cons (NULL_TREE, integer_type_node, tmp);
+  tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node);
+  tmp = tree_cons (NULL_TREE, type, tmp);
    fntype[5] = build_function_type (type, tmp);
  }