* [openacc, committed] Fix diff_type in expand_oacc_collapse_init
@ 2018-02-07 11:05 Tom de Vries
2018-02-07 19:37 ` Rainer Orth
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2018-02-07 11:05 UTC (permalink / raw)
To: Jakub Jelinek, Thomas Schwinge; +Cc: GCC Patches, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
Hi,
this patch fixes an 8 regression in an openacc testcase.
The regression was introduced by r250925, a fix for PR78266, a bug in
the handling of a loop with iteration variable type range smaller than
the size of the parallel dimension the loop is assigned to.
The fix for the regression is to apply the r250925 fix (in
expand_oacc_for) to expand_oacc_collapse_init as well.
Build and reg-tested on x86_64 with nvptx accelerator.
Committed to stage4 trunk.
Thanks,
- Tom
[-- Attachment #2: 0001-openacc-Fix-diff_type-in-expand_oacc_collapse_init.patch --]
[-- Type: text/x-patch, Size: 2457 bytes --]
[openacc] Fix diff_type in expand_oacc_collapse_init
2018-02-07 Tom de Vries <tom@codesourcery.com>
PR libgomp/84217
* omp-expand.c (expand_oacc_collapse_init): Ensure diff_type is large
enough.
* c-c++-common/goacc/pr84217.c: New test.
* gfortran.dg/goacc/pr84217.f90: New test.
* testsuite/libgomp.oacc-c-c++-common/pr84217.c: New test.
---
gcc/omp-expand.c | 2 ++
gcc/testsuite/c-c++-common/goacc/pr84217.c | 8 ++++++++
gcc/testsuite/gfortran.dg/goacc/pr84217.f90 | 9 +++++++++
.../testsuite/libgomp.oacc-c-c++-common/pr84217.c | 22 ++++++++++++++++++++++
4 files changed, 41 insertions(+)
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 90e0631..bb20490 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -1433,6 +1433,8 @@ expand_oacc_collapse_init (const struct omp_for_data *fd,
plus_type = sizetype;
if (POINTER_TYPE_P (diff_type) || TYPE_UNSIGNED (diff_type))
diff_type = signed_type_for (diff_type);
+ if (TYPE_PRECISION (diff_type) < TYPE_PRECISION (integer_type_node))
+ diff_type = integer_type_node;
if (tiling)
{
diff --git a/gcc/testsuite/c-c++-common/goacc/pr84217.c b/gcc/testsuite/c-c++-common/goacc/pr84217.c
new file mode 100644
index 0000000..c4f2920
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/pr84217.c
@@ -0,0 +1,8 @@
+void
+foo (void)
+{
+#pragma acc parallel loop tile (2, 3)
+ for (short i = 0; i < 10; ++i)
+ for (short j = 0; j < 10; ++j)
+ ;
+}
diff --git a/gcc/testsuite/gfortran.dg/goacc/pr84217.f90 b/gcc/testsuite/gfortran.dg/goacc/pr84217.f90
new file mode 100644
index 0000000..cee49e9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/pr84217.f90
@@ -0,0 +1,9 @@
+subroutine foo
+ integer(2) :: i, j
+ !$acc parallel loop tile(2,3)
+ do i = 1, 10
+ do j = 1, 10
+ end do
+ end do
+ !$acc end parallel loop
+end
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
new file mode 100644
index 0000000..18ff66a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
@@ -0,0 +1,22 @@
+extern void abort (void);
+
+#define N 10
+
+int
+main (void)
+{
+ int a[N];
+
+ for (short i = 0; i < N; ++i)
+ a[i] = -1;
+
+#pragma acc parallel loop tile (2)
+ for (short i = 0; i < N; ++i)
+ a[i] = i;
+
+ for (short i = 0; i < N; ++i)
+ if (a[i] != i)
+ abort ();
+
+ return 0;
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [openacc, committed] Fix diff_type in expand_oacc_collapse_init
2018-02-07 11:05 [openacc, committed] Fix diff_type in expand_oacc_collapse_init Tom de Vries
@ 2018-02-07 19:37 ` Rainer Orth
2018-02-07 20:19 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2018-02-07 19:37 UTC (permalink / raw)
To: Tom de Vries; +Cc: Jakub Jelinek, Thomas Schwinge, GCC Patches, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]
Hi Tom,
> this patch fixes an 8 regression in an openacc testcase.
>
> The regression was introduced by r250925, a fix for PR78266, a bug in the
> handling of a loop with iteration variable type range smaller than the size
> of the parallel dimension the loop is assigned to.
>
> The fix for the regression is to apply the r250925 fix (in expand_oacc_for)
> to expand_oacc_collapse_init as well.
>
> Build and reg-tested on x86_64 with nvptx accelerator.
>
> Committed to stage4 trunk.
[...]
> * testsuite/libgomp.oacc-c-c++-common/pr84217.c: New test.
this test FAILs when compiled as C++:
+FAIL: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/pr84217.c -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -O2 (test for excess errors)
+UNRESOLVED: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/pr84217.c -DACC_DEVIC
E_TYPE_host=1 -DACC_MEM_SHARED=1 -O2 compilation failed to produce executable
Excess errors:
Undefined first referenced
symbol in file
abort() /var/tmp//ccSsAnFc.o
(seen on i386-pc-solaris2.11 and sparc-sun-solaris2.11).
Fixed as follows, tested with the appropriate runtest invocations,
installed on mainline.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2018-02-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* testsuite/libgomp.oacc-c-c++-common/pr84217.c (abort)
[__cplusplus]: Declare extern "C".
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: libgomp-pr84217-c++.patch --]
[-- Type: text/x-patch, Size: 486 bytes --]
# HG changeset patch
# Parent e5c3e710215181503b228de2f9277e543392df2a
Fix libgomp.oacc-c-c++-common/pr84217.c for C++
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
@@ -1,4 +1,8 @@
-extern void abort (void);
+extern
+#ifdef __cplusplus
+"C"
+#endif
+void abort (void);
#define N 10
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [openacc, committed] Fix diff_type in expand_oacc_collapse_init
2018-02-07 19:37 ` Rainer Orth
@ 2018-02-07 20:19 ` Tom de Vries
0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2018-02-07 20:19 UTC (permalink / raw)
To: Rainer Orth; +Cc: Jakub Jelinek, Thomas Schwinge, GCC Patches, Richard Biener
On 02/07/2018 08:37 PM, Rainer Orth wrote:
> Hi Tom,
>
>> this patch fixes an 8 regression in an openacc testcase.
>>
>> The regression was introduced by r250925, a fix for PR78266, a bug in the
>> handling of a loop with iteration variable type range smaller than the size
>> of the parallel dimension the loop is assigned to.
>>
>> The fix for the regression is to apply the r250925 fix (in expand_oacc_for)
>> to expand_oacc_collapse_init as well.
>>
>> Build and reg-tested on x86_64 with nvptx accelerator.
>>
>> Committed to stage4 trunk.
> [...]
>> * testsuite/libgomp.oacc-c-c++-common/pr84217.c: New test.
>
> this test FAILs when compiled as C++:
>
> +FAIL: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/pr84217.c -DACC_DEVICE_TYPE_host=1 -DACC_MEM_SHARED=1 -O2 (test for excess errors)
> +UNRESOLVED: libgomp.oacc-c++/../libgomp.oacc-c-c++-common/pr84217.c -DACC_DEVIC
> E_TYPE_host=1 -DACC_MEM_SHARED=1 -O2 compilation failed to produce executable
>
> Excess errors:
> Undefined first referenced
> symbol in file
> abort() /var/tmp//ccSsAnFc.o
>
> (seen on i386-pc-solaris2.11 and sparc-sun-solaris2.11).
>
> Fixed as follows, tested with the appropriate runtest invocations,
> installed on mainline.
>
> Rainer
>
Hi Rainer,
thanks for fixing this oversight of mine.
- Tom
>
> libgomp-pr84217-c++.patch
>
>
> # HG changeset patch
> # Parent e5c3e710215181503b228de2f9277e543392df2a
> Fix libgomp.oacc-c-c++-common/pr84217.c for C++
>
> diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
> --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
> +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84217.c
> @@ -1,4 +1,8 @@
> -extern void abort (void);
> +extern
> +#ifdef __cplusplus
> +"C"
> +#endif
> +void abort (void);
>
> #define N 10
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-02-07 20:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-07 11:05 [openacc, committed] Fix diff_type in expand_oacc_collapse_init Tom de Vries
2018-02-07 19:37 ` Rainer Orth
2018-02-07 20:19 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).