]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix a crash due to mismatch of free and GOMP_alloc.
authorHafiz Abid Qadeer <abidh@codesourcery.com>
Wed, 30 Mar 2022 17:52:22 +0000 (18:52 +0100)
committerHafiz Abid Qadeer <abidh@codesourcery.com>
Fri, 1 Apr 2022 13:15:53 +0000 (14:15 +0100)
commit2e50103f04859f184734ec7b1ad2f18799cb63ef
treeaf12a9ed083621e1387bccca57d00774823ba396
parentfe9d2322f3b204ff4a1c517ca14a3b8c81cf943a
Fix a crash due to mismatch of free and GOMP_alloc.

With allocate directive, we replace the malloc calls to GOMP_alloc if
it is associated with the allocate statement.  The memory was supposed
to be free-d by the implicitely generated free calls which also get
replaced.  But if user explicitely deallocated the memory using the
deallocate statement, it can cause a mismatch.  This commit handles
that case and also replaces the free call generated for deallocate
clause.

Also added deallocate in the testcase and tidied it up a bit.

gcc/ChangeLog.omp:

* omp-low.c (lower_omp_allocate): Move allocate declaration
inside loop.  Set it to false at the end of condition.

libgomp/ChangeLog.omp:
* testsuite/libgomp.fortran/allocate-2.f90: Remove commented lines.
Add deallocate.  Remove omp_atk_pool_size trait.
gcc/ChangeLog.omp
gcc/omp-low.c
libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.fortran/allocate-2.f90