Improving code coverage of the testsuite
Dominique Dhumieres
dominiq@lps.ens.fr
Thu Nov 4 17:20:00 GMT 2010
> > Try this one.
> >
> > FUNCTION f(c)
> > IMPLICIT LOGICAL*4 (a-z)
> > print *, range(c)
> > END
> >
> >
> > Steve
>
> Nope, doesn't trigger the if. Seems like by this point every expression
> has a type.
My gdb session for the above test:
(gdb) b numeric_check
Breakpoint 1 at 0x100008ccf: file ../../work/gcc/fortran/check.c, line 74.
Breakpoint 2 at 0x100008ce3: file ../../work/gcc/fortran/check.c, line 79.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) run
Starting program: /opt/gcc/gcc4.6w/libexec/gcc/x86_64-apple-darwin10.4.0/4.6.0/f951 coverage_1.f90
Breakpoint 1, numeric_check (e=0x141915450, n=0) at ../../work/gcc/fortran/check.c:74
74 if (gfc_numeric_ts (&e->ts))
(gdb) c
Continuing.
Breakpoint 2, numeric_check (e=0x141915450, n=0) at ../../work/gcc/fortran/check.c:79
79 if ((e->expr_type == EXPR_VARIABLE || e->expr_type == EXPR_VARIABLE)
(gdb) s
80 && e->symtree->n.sym->ts.type == BT_UNKNOWN
(gdb) s
89 gfc_error ("'%s' argument of '%s' intrinsic at %L must be a numeric type",
(gdb) c
Continuing.
coverage_1.f90:3.23:
print *, range(c)
1
Error: 'x' argument of 'range' intrinsic at (1) must be a numeric type
So it goes through both if, but does not test:
&& gfc_set_default_type (e->symtree->n.sym, 0,
e->symtree->n.sym->ns) == SUCCESS
&& gfc_numeric_ts (&e->symtree->n.sym->ts))
Dominique
More information about the Fortran
mailing list