Bug 21375 - Rising run-time errors at DEALLOCATE with STAT clause
Summary: Rising run-time errors at DEALLOCATE with STAT clause
Status: RESOLVED DUPLICATE of bug 17792
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-04 05:54 UTC by Nikolay A. Fetisov
Modified: 2005-06-05 15:01 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-05-11 21:04:15


Attachments
Sample code (127 bytes, text/plain)
2005-05-04 05:57 UTC, Nikolay A. Fetisov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay A. Fetisov 2005-05-04 05:54:57 UTC
When errors happens in DEALLOCATE with STAT the run-time error rises instead
setting up STAT variable. For example, following code:

-----------------------------
PROGRAM MAIN
INTEGER, POINTER :: foo
INTEGER IERR
DEALLOCATE(foo,STAT=IERR)
WRITE (*,*) IERR
END PROGRAM
-----------------------------

fails with 'Fortran runtime error: Internal: Attempt to DEALLOCATE unallocated
memory.' instead of setting IERR.

This bug corresponds with #17792.
Comment 1 Nikolay A. Fetisov 2005-05-04 05:57:25 UTC
Created attachment 8815 [details]
Sample code
Comment 2 Nikolay A. Fetisov 2005-05-04 05:58:28 UTC
Tested with GNU F95 version 4.1.0 20050502 (experimental) (i386-linux)
Comment 3 kargls 2005-06-04 17:39:58 UTC
Patch is give here

http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00334.html
Comment 4 kargls 2005-06-05 15:01:56 UTC
Salvatore Filippone pointed out that 21375 is a duplicate of 17792.

*** This bug has been marked as a duplicate of 17792 ***
Comment 5 GCC Commits 2005-06-11 22:29:24 UTC
Subject: Bug 21375

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kargl@gcc.gnu.org	2005-06-11 22:29:18

Modified files:
	gcc/fortran    : ChangeLog trans-array.c trans-array.h 
	                 trans-decl.c trans-stmt.c 

Log message:
	PR fortran/17792
	PR fortran/21375
	* trans-array.c (gfc_array_deallocate): pstat is new argument
	(gfc_array_allocate): update gfc_array_deallocate() call.
	(gfc_trans_deferred_array): ditto.
	* trans-array.h: update gfc_array_deallocate() prototype.
	* trans-decl.c (gfc_build_builtin_function_decls): update declaration
	* trans-stmt.c (gfc_trans_deallocate): Implement STAT= feature.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.459&r2=1.460
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&r1=1.48&r2=1.49
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.h.diff?cvsroot=gcc&r1=1.8&r2=1.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-decl.c.diff?cvsroot=gcc&r1=1.60&r2=1.61
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-stmt.c.diff?cvsroot=gcc&r1=1.32&r2=1.33

Comment 6 GCC Commits 2005-06-11 22:33:20 UTC
Subject: Bug 21375

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	kargl@gcc.gnu.org	2005-06-11 22:33:11

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: deallocate_stat.f90 

Log message:
	PR fortran/17792
	PR fortran/21375
	* gfortran.dg/deallocate_statO.f90:  New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5622&r2=1.5623
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/deallocate_stat.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 7 GCC Commits 2005-07-08 21:19:41 UTC
Subject: Bug 21375

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	kargl@gcc.gnu.org	2005-07-08 21:19:28

Modified files:
	gcc/fortran    : ChangeLog intrinsic.c match.c primary.c 
	                 trans-array.c trans-array.h trans-decl.c 
	                 trans-stmt.c 

Log message:
	Backport from the mainline:
	PR fortran/21257
	(port from g95)
	* match.c (gfc_match_label): Detect duplicate labels.
	* gfortran.dg/duplicate_labels.f90: New test.
	
	PR fortran/19926
	* primary.c (gfc_match_rvalue):  expr_type can be EXPR_CONSTANT
	for an array; check that sym->as is NULL.
	* gfortran.dg/pr19926.f90: New test.
	
	PR fortran/17792
	PR fortran/21375
	* trans-array.c (gfc_array_deallocate): pstat is new argument
	(gfc_array_allocate): update gfc_array_deallocate() call.
	(gfc_trans_deferred_array): ditto.
	* trans-array.h: update gfc_array_deallocate() prototype.
	* trans-decl.c (gfc_build_builtin_function_decls): update declaration
	* trans-stmt.c (gfc_trans_deallocate): Implement STAT= feature.
	
	* intrinsic.c (gfc_intrinsic_func_interface): Enable errors for generic
	functions whose simplification routine return FAILURE.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.76&r2=1.335.2.77
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/intrinsic.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.44.2.3&r2=1.44.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/match.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.31.8.7&r2=1.31.8.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/primary.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.22.2.4&r2=1.22.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.39.2.5&r2=1.39.2.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.7.18.1&r2=1.7.18.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.54.2.3&r2=1.54.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-stmt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.24.6.5&r2=1.24.6.6