aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2008-09-18 14:02:50 +0200
committerDaniel Kraft <domob@gcc.gnu.org>2008-09-18 14:02:50 +0200
commitf25a62a5f34a0f33b00238c6c681edac038e1078 (patch)
treee5471c68dc29810955e55c653efe13687946b17a /gcc/fortran/trans-array.c
parente7089ecf1c8a67d5572ada8ecd3b3d99f420089c (diff)
downloadgcc-f25a62a5f34a0f33b00238c6c681edac038e1078.zip
gcc-f25a62a5f34a0f33b00238c6c681edac038e1078.tar.gz
gcc-f25a62a5f34a0f33b00238c6c681edac038e1078.tar.bz2
re PR fortran/37507 (Print location in (DE)ALLOCATION errors)
2008-09-18 Daniel Kraft <d@domob.eu> PR fortran/37507 * trans.h (gfc_trans_runtime_error): New method. (gfc_trans_runtime_error_vararg): New method. (gfc_allocate_array_with_status): New argument `expr' for locus/varname. (gfc_deallocate_array_with_status): Ditto. * trans-array.h (gfc_array_deallocate): Ditto. * trans.c (gfc_trans_runtime_error): New method. (gfc_trans_runtime_error_vararg): New method, moved parts of the code from gfc_trans_runtime_check here. (gfc_trans_runtime_error_check): Moved code partly to new method. (gfc_call_malloc): Fix tab-indentation. (gfc_allocate_array_with_status): New argument `expr' and call gfc_trans_runtime_error for error reporting to include locus. (gfc_deallocate_with_status): Ditto. * trans-stmt.c (gfc_trans_deallocate): Pass expr as new argument. * trans-array.c (gfc_array_allocate): Ditto. (gfc_array_deallocate): New argument `expr', passed on. (gfc_trans_dealloc_allocated): Pass NULL for expr. * trans-openmp.c (gfc_omp_clause_default): Ditto. 2008-09-18 Daniel Kraft <d@domob.eu> PR fortran/37507 * gfortran.dg/allocate_error_1.f90: New test. * gfortran.dg/deallocate_error_1.f90: New test. * gfortran.dg/deallocate_error_2.f90: New test. From-SVN: r140451
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 1ab58e1..f4af4f2 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -3796,7 +3796,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
/* The allocate_array variants take the old pointer as first argument. */
if (allocatable_array)
- tmp = gfc_allocate_array_with_status (&se->pre, pointer, size, pstat);
+ tmp = gfc_allocate_array_with_status (&se->pre, pointer, size, pstat, expr);
else
tmp = gfc_allocate_with_status (&se->pre, size, pstat);
tmp = fold_build2 (MODIFY_EXPR, void_type_node, pointer, tmp);
@@ -3822,7 +3822,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
/*GCC ARRAYS*/
tree
-gfc_array_deallocate (tree descriptor, tree pstat)
+gfc_array_deallocate (tree descriptor, tree pstat, gfc_expr* expr)
{
tree var;
tree tmp;
@@ -3834,7 +3834,7 @@ gfc_array_deallocate (tree descriptor, tree pstat)
STRIP_NOPS (var);
/* Parameter is the address of the data component. */
- tmp = gfc_deallocate_with_status (var, pstat, false);
+ tmp = gfc_deallocate_with_status (var, pstat, false, expr);
gfc_add_expr_to_block (&block, tmp);
/* Zero the data pointer. */
@@ -5341,7 +5341,7 @@ gfc_trans_dealloc_allocated (tree descriptor)
/* Call array_deallocate with an int * present in the second argument.
Although it is ignored here, it's presence ensures that arrays that
are already deallocated are ignored. */
- tmp = gfc_deallocate_with_status (var, NULL_TREE, true);
+ tmp = gfc_deallocate_with_status (var, NULL_TREE, true, NULL);
gfc_add_expr_to_block (&block, tmp);
/* Zero the data pointer. */