diff options
author | Daniel Kraft <d@domob.eu> | 2010-07-28 19:06:40 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2010-07-28 19:06:40 +0200 |
commit | 69dcd06ab86aef723efcc294d64e31ef159ae3c0 (patch) | |
tree | d6abc79640b3f8726b5ce5ea87b458be1a547ddc /gcc/fortran/expr.c | |
parent | 05b5ea3495029f4da3687c03a27d70dad682f585 (diff) | |
download | gcc-69dcd06ab86aef723efcc294d64e31ef159ae3c0.zip gcc-69dcd06ab86aef723efcc294d64e31ef159ae3c0.tar.gz gcc-69dcd06ab86aef723efcc294d64e31ef159ae3c0.tar.bz2 |
gfortran.h (gfc_build_intrinsic_call): New method.
2010-07-28 Daniel Kraft <d@domob.eu>
* gfortran.h (gfc_build_intrinsic_call): New method.
* expr.c (gfc_build_intrinsic_call): New method.
* simplify.c (range_check): Ignore non-constant value.
(simplify_bound_dim): Handle non-variable expressions and
fix memory leak with non-free'ed expression.
(simplify_bound): Handle non-variable expressions.
(gfc_simplify_shape): Ditto.
(gfc_simplify_size): Ditto, but only in certain cases possible.
2010-07-28 Daniel Kraft <d@domob.eu>
* gfortran.dg/bound_8.f90: New test.
From-SVN: r162648
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index cb7305e..661cac4 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4199,3 +4199,47 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict) return true; } + + +/* Build call to an intrinsic procedure. The number of arguments has to be + passed (rather than ending the list with a NULL value) because we may + want to add arguments but with a NULL-expression. */ + +gfc_expr* +gfc_build_intrinsic_call (const char* name, locus where, unsigned numarg, ...) +{ + gfc_expr* result; + gfc_actual_arglist* atail; + gfc_intrinsic_sym* isym; + va_list ap; + unsigned i; + + isym = gfc_find_function (name); + gcc_assert (isym); + + result = gfc_get_expr (); + result->expr_type = EXPR_FUNCTION; + result->ts = isym->ts; + result->where = where; + gfc_get_ha_sym_tree (isym->name, &result->symtree); + result->value.function.name = name; + result->value.function.isym = isym; + + va_start (ap, numarg); + atail = NULL; + for (i = 0; i < numarg; ++i) + { + if (atail) + { + atail->next = gfc_get_actual_arglist (); + atail = atail->next; + } + else + atail = result->value.function.actual = gfc_get_actual_arglist (); + + atail->expr = va_arg (ap, gfc_expr*); + } + va_end (ap); + + return result; +} |