Message ID | 4D9341A5.8020909@free.fr |
---|---|
State | New |
Headers | show |
Ping? On 30/03/11 16:43, Duncan Sands wrote: > While working on the dragonegg plugin I noticed that the Fortran front-end > declares frexp with the parameters the wrong way round. Instead of > double frexp(double x, int *exp); > it is declared as > double frexp(int *exp, double x); > This is fairly harmless but might as well be fixed, so here is a patch (as far > as I can see fntype[4] is only used in declaring the frexp family of functions). > Bootstraps and has no impact on the Fortran testsuite (tested on mainline). OK > to apply on mainline and the 4.5 and 4.6 branches? > > Proposed fortran/Changelog entry: > 2011-03-30 Duncan Sands <baldrick@free.fr> > > * f95-lang.c (build_builtin_fntypes): Swap frexp parameter types. > > > Index: gcc/fortran/f95-lang.c > =================================================================== > --- gcc/fortran/f95-lang.c (revision 171716) > +++ gcc/fortran/f95-lang.c (working copy) > @@ -695,10 +695,9 @@ > type, integer_type_node, NULL_TREE); > /* type (*) (void) */ > fntype[3] = build_function_type_list (type, NULL_TREE); > - /* type (*) (&int, type) */ > - fntype[4] = build_function_type_list (type, > + /* type (*) (type, &int) */ > + fntype[4] = build_function_type_list (type, type, > build_pointer_type (integer_type_node), > - type, > NULL_TREE); > /* type (*) (int, type) */ > fntype[5] = build_function_type_list (type,
Duncan Sands wrong: > Ping? Pong. It helps to send Fortran patches also to fortran@ ... > On 30/03/11 16:43, Duncan Sands wrote: >> While working on the dragonegg plugin I noticed that the Fortran >> front-end >> declares frexp with the parameters the wrong way round. Instead of >> double frexp(double x, int *exp); >> it is declared as >> double frexp(int *exp, double x); >> OK to apply on mainline and the 4.5 and 4.6 branches? OK and thanks for the patch. Do you have an GCC SVN account? Tobias >> 2011-03-30 Duncan Sands <baldrick@free.fr> >> >> * f95-lang.c (build_builtin_fntypes): Swap frexp parameter types. >> >> - /* type (*) (&int, type) */ >> - fntype[4] = build_function_type_list (type, >> + /* type (*) (type, &int) */ >> + fntype[4] = build_function_type_list (type, type, >> build_pointer_type (integer_type_node), >> - type, >> NULL_TREE); >
Hi Tobias, > Pong. It helps to send Fortran patches also to fortran@ ... indeed :) >> On 30/03/11 16:43, Duncan Sands wrote: >>> While working on the dragonegg plugin I noticed that the Fortran front-end >>> declares frexp with the parameters the wrong way round. Instead of >>> double frexp(double x, int *exp); >>> it is declared as >>> double frexp(int *exp, double x); > >>> OK to apply on mainline and the 4.5 and 4.6 branches? > > OK and thanks for the patch. Do you have an GCC SVN account? 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: gfc_define_builtin ("__builtin_scalbnl", mfunc_longdouble[5], BUILT_IN_SCALBNL, "scalbnl", ATTR_CONST_NOTHROW_LEAF_LIST); gfc_define_builtin ("__builtin_scalbn", mfunc_double[5], BUILT_IN_SCALBN, "scalbn", ATTR_CONST_NOTHROW_LEAF_LIST); gfc_define_builtin ("__builtin_scalbnf", mfunc_float[5], BUILT_IN_SCALBNF, "scalbnf", ATTR_CONST_NOTHROW_LEAF_LIST); but /* type (*) (int, type) */ fntype[5] = build_function_type_list (type, integer_type_node, type, NULL_TREE); so it looks like you get scalbn(int, double) and not scalbn(double, int) etc. If you agree that they are the wrong way round I will fix this too. Ciao, Duncan. > > Tobias > >>> 2011-03-30 Duncan Sands <baldrick@free.fr> >>> >>> * f95-lang.c (build_builtin_fntypes): Swap frexp parameter types. >>> >>> - /* type (*) (&int, type) */ >>> - fntype[4] = build_function_type_list (type, >>> + /* type (*) (type, &int) */ >>> + fntype[4] = build_function_type_list (type, type, >>> build_pointer_type (integer_type_node), >>> - type, >>> NULL_TREE); >> >
Index: gcc/fortran/f95-lang.c =================================================================== --- gcc/fortran/f95-lang.c (revision 171716) +++ gcc/fortran/f95-lang.c (working copy) @@ -695,10 +695,9 @@ type, integer_type_node, NULL_TREE); /* type (*) (void) */ fntype[3] = build_function_type_list (type, NULL_TREE); - /* type (*) (&int, type) */ - fntype[4] = build_function_type_list (type, + /* type (*) (type, &int) */ + fntype[4] = build_function_type_list (type, type, build_pointer_type (integer_type_node), - type, NULL_TREE); /* type (*) (int, type) */ fntype[5] = build_function_type_list (type,