libgfortran/ChangeLog:

2017-01-29  Andre Vehreschild  <vehre@gcc.gnu.org>

	Backport from trunk
	2017-01-13  Andre Vehreschild  <vehre@gcc.gnu.org>

	PR fortran/68887
	PR fortran/70696
	* caf/single.c (_gfortran_caf_register): Allocate enough memory for
	the event counter.




git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@245016 138bc75d-0d04-0410-961f-82ee72b054a4
This commit is contained in:
vehre 2017-01-29 15:14:41 +00:00
parent 839e361aa2
commit 4fbcba038f

View File

@ -101,9 +101,12 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
void *local;
if (type == CAF_REGTYPE_LOCK_STATIC || type == CAF_REGTYPE_LOCK_ALLOC
|| type == CAF_REGTYPE_CRITICAL || type == CAF_REGTYPE_EVENT_STATIC
|| type == CAF_REGTYPE_EVENT_ALLOC)
local = calloc (size, sizeof (bool));
|| type == CAF_REGTYPE_CRITICAL)
local = calloc (size, sizeof (bool));
else if (type == CAF_REGTYPE_EVENT_STATIC || type == CAF_REGTYPE_EVENT_ALLOC)
/* In the event_(wait|post) function the counter for events is a uint32,
so better allocate enough memory here. */
local = calloc (size, sizeof (uint32_t));
else
local = malloc (size);
*token = malloc (sizeof (single_token_t));