diff --git a/libgomp/stream.c b/libgomp/stream.c index 196b15789..0269e62f3 100644 --- a/libgomp/stream.c +++ b/libgomp/stream.c @@ -42,6 +42,7 @@ #define AGGREGATION_FACTOR 32 +#define ENSURE_BUFSIZE //#define OMP_STREAM_DEBUG #ifdef OMP_STREAM_DEBUG #define debug_log_init(S, V1, V2) printf (S, V1, V2); fflush (stdout) @@ -727,9 +728,17 @@ GOMP_batchQ_update (void *v, const unsigned long long act_start, low_idx = act_start * view->burst_size; up_idx = act_end * view->burst_size + view->pxxk_size - 1; +#ifdef ENSURE_BUFSIZE if (up_idx - low_idx + 1 != stream->buffer_size) - if (!view->termination_flag) + { +#endif + if (up_idx - low_idx + 1 > stream->buffer_size) gomp_fatal ("GOMP_batchQ: update requested access to more than buffer_size data."); +#ifdef ENSURE_BUFSIZE + else if (!view->termination_flag) + gomp_fatal ("GOMP_batchQ: update requested access to less than buffer_size data."); + } +#endif while (!stream->state); @@ -791,9 +800,19 @@ GOMP_batchQ_stall (void *v, const unsigned long long act_start, low_idx = act_start * view->burst_size + stream->pre_shift; up_idx = act_end * view->burst_size + view->pxxk_size + stream->pre_shift - 1; +#ifdef ENSURE_BUFSIZE if (up_idx - low_idx + 1 != stream->buffer_size) - if (!view->termination_flag) - gomp_fatal ("GOMP_stream: stall requested access to an amount of data different that buffer_size."); + { +#endif + if (up_idx - low_idx + 1 > stream->buffer_size) + { + gomp_fatal ("GOMP_batchQ: stall requested access to more than buffer_size."); + } +#ifdef ENSURE_BUFSIZE + else if (!view->termination_flag) + gomp_fatal ("GOMP_stream: stall requested access to less than buffer_size."); + } +#endif return (void *) stream->sender_ptr; }