This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, Fortran] Correct declaration of frexp and friends


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);
}





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]