public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
@ 2020-10-06 12:17 ` vries at gcc dot gnu.org
2020-10-06 13:29 ` vries at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-06 12:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 49317
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49317&action=edit
Tentative patch
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
2020-10-06 12:17 ` [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs vries at gcc dot gnu.org
@ 2020-10-06 13:29 ` vries at gcc dot gnu.org
2020-10-06 14:50 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-06 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555606.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
2020-10-06 12:17 ` [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs vries at gcc dot gnu.org
2020-10-06 13:29 ` vries at gcc dot gnu.org
@ 2020-10-06 14:50 ` cvs-commit at gcc dot gnu.org
2020-10-06 14:52 ` vries at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-06 14:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@gcc.gnu.org>:
https://gcc.gnu.org/g:3f2e15c2e66af9cca1dfe24ad7e9692f511ebd06
commit r11-3680-g3f2e15c2e66af9cca1dfe24ad7e9692f511ebd06
Author: Tom de Vries <tdevries@suse.de>
Date: Tue Oct 6 13:07:25 2020 +0200
[openacc] Fix acc declare for VLAs
Consider test-case test.c, with VLA A:
...
int main (void) {
int N = 1000;
int A[N];
#pragma acc declare copy(A)
return 0;
}
...
compiled using:
...
$ gcc test.c -fopenacc -S -fdump-tree-all
...
At original, we have:
...
#pragma acc declare map(tofrom:A);
...
but at gimple, we have a map (to:A.1), but not a map (from:A.1):
...
int[0:D.2074] * A.1;
{
int A[0:D.2074] [value-expr: *A.1];
saved_stack.2 = __builtin_stack_save ();
try
{
A.1 = __builtin_alloca_with_align (D.2078, 32);
#pragma omp target oacc_declare map(to:(*A.1) [len: D.2076])
}
finally
{
__builtin_stack_restore (saved_stack.2);
}
}
...
This is caused by the following incompatibility. When storing the desired
from clause in oacc_declare_returns, we use 'A.1' as the key:
...
10898 oacc_declare_returns->put (decl, c);
(gdb) call debug_generic_expr (decl)
A.1
(gdb) call debug_generic_expr (c)
map(from:(*A.1))
...
but when looking it up, we use 'A' as the key:
...
(gdb)
1471 tree *c = oacc_declare_returns->get (t);
(gdb) call debug_generic_expr (t)
A
...
Fix this by extracing the 'A.1' lookup key from 'A' using the decl-expr.
In addition, unshare the looked up value, to fix avoid running into
an "incorrect sharing of tree nodes" error.
Using these two fixes, we get our desired:
...
finally
{
+ #pragma omp target oacc_declare map(from:(*A.1))
__builtin_stack_restore (saved_stack.2);
}
...
Build on x86_64-linux with nvptx accelerator, tested libgomp.
gcc/ChangeLog:
2020-10-06 Tom de Vries <tdevries@suse.de>
PR middle-end/90861
* gimplify.c (gimplify_bind_expr): Handle lookup in
oacc_declare_returns using key with decl-expr.
libgomp/ChangeLog:
2020-10-06 Tom de Vries <tdevries@suse.de>
PR middle-end/90861
* testsuite/libgomp.oacc-c-c++-common/declare-vla.c: Remove xfail.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-10-06 14:50 ` cvs-commit at gcc dot gnu.org
@ 2020-10-06 14:52 ` vries at gcc dot gnu.org
2020-10-06 16:31 ` tschwinge at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 7+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-06 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |11.0
--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed, marking resolved-fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-10-06 14:52 ` vries at gcc dot gnu.org
@ 2020-10-06 16:31 ` tschwinge at gcc dot gnu.org
2020-10-06 21:35 ` cvs-commit at gcc dot gnu.org
2020-10-06 21:40 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-10-06 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |vries at gcc dot gnu.org
Resolution|FIXED |---
Status|RESOLVED |REOPENED
CC| |burnus at gcc dot gnu.org
--- Comment #8 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Tom, thanks for resolving this! Just one more item: let's please also update
'c-c++-common/goacc/declare-pr90861.c' (current XFAIL) to match reality.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-10-06 16:31 ` tschwinge at gcc dot gnu.org
@ 2020-10-06 21:35 ` cvs-commit at gcc dot gnu.org
2020-10-06 21:40 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-06 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:
https://gcc.gnu.org/g:a9802204603616df14ed47d05f1b86f1bd08d8fb
commit r11-3687-ga9802204603616df14ed47d05f1b86f1bd08d8fb
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Tue Oct 6 23:34:21 2020 +0200
c-c++-common/goacc/declare-pr90861.c: Remove xfail
gcc/testsuite/ChangeLog
PR middle-end/90861
* c-c++-common/goacc/declare-pr90861.c: Remove xfail.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2020-10-06 21:35 ` cvs-commit at gcc dot gnu.org
@ 2020-10-06 21:40 ` burnus at gcc dot gnu.org
6 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-10-06 21:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90861
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution|--- |FIXED
--- Comment #10 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Thomas Schwinge from comment #8)
> let's please also update 'c-c++-common/goacc/declare-pr90861.c'
Well spotted – now FIXED.
Thanks for spotting – and to Tom for fixing the actual issue.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-10-06 21:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-90861-4@http.gcc.gnu.org/bugzilla/>
2020-10-06 12:17 ` [Bug middle-end/90861] OpenACC 'declare' not cleaning up for VLAs vries at gcc dot gnu.org
2020-10-06 13:29 ` vries at gcc dot gnu.org
2020-10-06 14:50 ` cvs-commit at gcc dot gnu.org
2020-10-06 14:52 ` vries at gcc dot gnu.org
2020-10-06 16:31 ` tschwinge at gcc dot gnu.org
2020-10-06 21:35 ` cvs-commit at gcc dot gnu.org
2020-10-06 21:40 ` burnus at gcc dot gnu.org
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).