* [PATCH] Use relayout_decl instead of layout_decl when completing vars with incomplete types (PR c/51339)
@ 2011-12-05 20:22 Jakub Jelinek
2011-12-05 20:43 ` Joseph S. Myers
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2011-12-05 20:22 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
Hi!
The following testcase ICEs, because in finish_decl the C FE doesn't
relayout_decl after changing the type from char [] to char [2], so it
is not updated from BLKmode to HImode. WHen OpenMP creates the private
copy of the var, the type is complete from the beginning and therefore
it is HImode, and durng expansion when we try to expand HImode = BLKmode
assignment we ICE. The C++ in these cases calls relayout_decl.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?
2011-12-05 Jakub Jelinek <jakub@redhat.com>
PR c/51339
* c-decl.c (c_finish_incomplete_decl, finish_decl): Call
relayout_decl instead of layout_decl.
* gcc.dg/gomp/pr51339.c: New test.
--- gcc/c-decl.c.jj 2011-11-28 17:58:04.000000000 +0100
+++ gcc/c-decl.c 2011-12-05 16:39:46.713393079 +0100
@@ -719,7 +719,7 @@ c_finish_incomplete_decl (tree decl)
complete_array_type (&TREE_TYPE (decl), NULL_TREE, true);
- layout_decl (decl, 0);
+ relayout_decl (decl);
}
}
}
@@ -4311,7 +4311,7 @@ finish_decl (tree decl, location_t init_
if (DECL_INITIAL (decl))
TREE_TYPE (DECL_INITIAL (decl)) = type;
- layout_decl (decl, 0);
+ relayout_decl (decl);
}
if (TREE_CODE (decl) == VAR_DECL)
--- gcc/testsuite/gcc.dg/gomp/pr51339.c.jj 2011-12-05 17:23:12.190987532 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr51339.c 2011-12-05 17:22:50.000000000 +0100
@@ -0,0 +1,15 @@
+/* PR c/51339 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+char g[] = "g";
+
+void
+foo (void)
+{
+#pragma omp parallel sections firstprivate (g) lastprivate (g)
+ {
+ #pragma omp section
+ g[0] = 'h';
+ }
+}
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use relayout_decl instead of layout_decl when completing vars with incomplete types (PR c/51339)
2011-12-05 20:22 [PATCH] Use relayout_decl instead of layout_decl when completing vars with incomplete types (PR c/51339) Jakub Jelinek
@ 2011-12-05 20:43 ` Joseph S. Myers
2012-02-08 23:18 ` Ulrich Weigand
0 siblings, 1 reply; 4+ messages in thread
From: Joseph S. Myers @ 2011-12-05 20:43 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Mon, 5 Dec 2011, Jakub Jelinek wrote:
> 2011-12-05 Jakub Jelinek <jakub@redhat.com>
>
> PR c/51339
> * c-decl.c (c_finish_incomplete_decl, finish_decl): Call
> relayout_decl instead of layout_decl.
>
> * gcc.dg/gomp/pr51339.c: New test.
OK.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use relayout_decl instead of layout_decl when completing vars with incomplete types (PR c/51339)
2011-12-05 20:43 ` Joseph S. Myers
@ 2012-02-08 23:18 ` Ulrich Weigand
2012-02-09 9:35 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Weigand @ 2012-02-08 23:18 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: Jakub Jelinek, gcc-patches
Joseph S. Myers wrote:
> On Mon, 5 Dec 2011, Jakub Jelinek wrote:
>
> > 2011-12-05 Jakub Jelinek <jakub@redhat.com>
> >
> > PR c/51339
> > * c-decl.c (c_finish_incomplete_decl, finish_decl): Call
> > relayout_decl instead of layout_decl.
> >
> > * gcc.dg/gomp/pr51339.c: New test.
>
> OK.
The finish_decl change appears to have introduced a regression
in attribute ((aligned)) handling. With the following code:
extern const int foo[];
const int __attribute__((aligned(16))) foo[] = { 0 };
the attribute now seems to be ignored; reverting the change
above causes the attribute to be honored again.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Use relayout_decl instead of layout_decl when completing vars with incomplete types (PR c/51339)
2012-02-08 23:18 ` Ulrich Weigand
@ 2012-02-09 9:35 ` Jakub Jelinek
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2012-02-09 9:35 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Joseph S. Myers, gcc-patches
On Thu, Feb 09, 2012 at 12:11:45AM +0100, Ulrich Weigand wrote:
> The finish_decl change appears to have introduced a regression
> in attribute ((aligned)) handling. With the following code:
>
> extern const int foo[];
> const int __attribute__((aligned(16))) foo[] = { 0 };
>
> the attribute now seems to be ignored; reverting the change
> above causes the attribute to be honored again.
Seems the bug is elsewhere though, testing a fix, see
PR52181 I've filed for this.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-09 9:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 20:22 [PATCH] Use relayout_decl instead of layout_decl when completing vars with incomplete types (PR c/51339) Jakub Jelinek
2011-12-05 20:43 ` Joseph S. Myers
2012-02-08 23:18 ` Ulrich Weigand
2012-02-09 9:35 ` Jakub Jelinek
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).