[gfortran,ping] support for large kinds in front-end and library

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Aug 20 18:51:00 GMT 2005


My first comment.  More to come.

> @@ -1786,37 +1796,56 @@ gfc_build_intrinsic_function_decls (void
>  
>    /* Power functions.  */
>    {
> -    tree type;
> -    tree itype;
> -    int kind;
> -    int ikind;
> -    static int kinds[2] = {4, 8};
> +    tree ctype, rtype, itype, jtype;
> +    int rkind, ikind, jkind;
> +#define NIKINDS 3
> +#define NRKINDS 4
> +    static int ikinds[NIKINDS] = {4, 8, 16};
> +    static int rkinds[NRKINDS] = {4, 8, 10, 16};
>      char name[PREFIX_LEN + 10]; /* _gfortran_pow_?n_?n */

If _gfortran_pow_i16_i16 is a possible function name, then

> +	      {
> +	        sprintf(name, PREFIX("pow_i%d_i%d"), ikinds[ikind],
> +		    ikinds[jkind]);

this is a buffer overflow. 

-- 
steve



More information about the Fortran mailing list