* [Bug tree-optimization/48098] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
@ 2011-03-12 23:30 ` schnetter at gmail dot com
2011-03-14 9:21 ` [Bug tree-optimization/48098] [4.6 Regression] " jakub at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: schnetter at gmail dot com @ 2011-03-12 23:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
--- Comment #1 from Erik Schnetter <schnetter at gmail dot com> 2011-03-12 23:30:41 UTC ---
Here is a reduced test case:
void BndRot180VI ()
{
static char *restrict * slab_setups;
static int num_slab_setups = 0;
num_slab_setups = GetRefinementLevels (0);
slab_setups = malloc (num_slab_setups);
for (int rl=0; rl<num_slab_setups; ++rl) {
slab_setups[rl] = 0;
}
}
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
2011-03-12 23:30 ` [Bug tree-optimization/48098] " schnetter at gmail dot com
@ 2011-03-14 9:21 ` jakub at gcc dot gnu.org
2011-03-14 9:29 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-14 9:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
Status|UNCONFIRMED |NEW
Known to work| |4.5.2
Keywords| |ice-on-valid-code
Last reconfirmed| |2011.03.14 09:21:19
CC| |jakub at gcc dot gnu.org
Ever Confirmed|0 |1
Summary|internal compiler error: in |[4.6 Regression] internal
|build_vector_from_val, at |compiler error: in
|tree.c:1380 |build_vector_from_val, at
| |tree.c:1380
Target Milestone|--- |4.6.0
Known to fail| |4.6.0
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-14 09:21:19 UTC ---
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166136
together with the earlier
http://gcc.gnu.org/viewcvs?view=revision&revision=166102
change.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
2011-03-12 23:30 ` [Bug tree-optimization/48098] " schnetter at gmail dot com
2011-03-14 9:21 ` [Bug tree-optimization/48098] [4.6 Regression] " jakub at gcc dot gnu.org
@ 2011-03-14 9:29 ` jakub at gcc dot gnu.org
2011-03-14 9:38 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-14 9:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-14 09:29:02 UTC ---
Smaller testcase:
void
foo (int n)
{
static char *__restrict *p;
int i;
p = __builtin_malloc (n);
for (i = 0; i < n; i++)
p[i] = 0;
}
The reason why the conversion between char * types isn't useless is that one of
the pointers is TYPE_RESTRICT, while the other one is not.
--- gcc/tree.c.jj 2011-03-11 12:16:39.000000000 +0100
+++ gcc/tree.c 2011-03-14 10:27:25.000000000 +0100
@@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tre
if (sc == error_mark_node)
return sc;
- gcc_assert (useless_type_conversion_p (TREE_TYPE (sc),
- TREE_TYPE (vectype)));
+ gcc_assert (useless_type_conversion_p (TYPE_MAIN_VARIANT (TREE_TYPE (sc)),
+ TYPE_MAIN_VARIANT (TREE_TYPE (vectype))));
v = VEC_alloc (constructor_elt, gc, nunits);
for (i = 0; i < nunits; ++i)
fixes the ICE, but I wonder whether it isn't instead a bug in the vectorizer.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (2 preceding siblings ...)
2011-03-14 9:29 ` jakub at gcc dot gnu.org
@ 2011-03-14 9:38 ` jakub at gcc dot gnu.org
2011-03-14 9:38 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-14 9:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P1 |P3
Target Milestone|4.6.0 |---
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-14 09:38:12 UTC ---
Though, apparently make_vector_type intentionally uses TYPE_MAIN_VARIANT of
innertype as VECTOR_TYPE's type, and puts the quals on the vector type itself.
Richard, what do you prefer?
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (3 preceding siblings ...)
2011-03-14 9:38 ` jakub at gcc dot gnu.org
@ 2011-03-14 9:38 ` jakub at gcc dot gnu.org
2011-03-14 9:39 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-14 9:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.6.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (4 preceding siblings ...)
2011-03-14 9:38 ` jakub at gcc dot gnu.org
@ 2011-03-14 9:39 ` jakub at gcc dot gnu.org
2011-03-14 9:59 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-14 9:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (5 preceding siblings ...)
2011-03-14 9:39 ` jakub at gcc dot gnu.org
@ 2011-03-14 9:59 ` jakub at gcc dot gnu.org
2011-03-14 10:43 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-14 9:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-14 09:59:32 UTC ---
Just swapping the order of arguments to useless_type_conversion_p works too.
If we consider build_vector_from_val as conversion from sc's type to the inner
type of the vector, then vectype's inner type as outer_type needs to go first:
--- gcc/tree.c.jj 2011-03-11 12:16:39.000000000 +0100
+++ gcc/tree.c 2011-03-14 10:57:21.000000000 +0100
@@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tre
if (sc == error_mark_node)
return sc;
- gcc_assert (useless_type_conversion_p (TREE_TYPE (sc),
- TREE_TYPE (vectype)));
+ gcc_assert (useless_type_conversion_p (TREE_TYPE (vectype),
+ TREE_TYPE (sc)));
v = VEC_alloc (constructor_elt, gc, nunits);
for (i = 0; i < nunits; ++i)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (6 preceding siblings ...)
2011-03-14 9:59 ` jakub at gcc dot gnu.org
@ 2011-03-14 10:43 ` rguenth at gcc dot gnu.org
2011-03-14 10:51 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 10:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 10:43:09 UTC ---
(In reply to comment #5)
> Just swapping the order of arguments to useless_type_conversion_p works too.
> If we consider build_vector_from_val as conversion from sc's type to the inner
> type of the vector, then vectype's inner type as outer_type needs to go first:
>
> --- gcc/tree.c.jj 2011-03-11 12:16:39.000000000 +0100
> +++ gcc/tree.c 2011-03-14 10:57:21.000000000 +0100
> @@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tre
> if (sc == error_mark_node)
> return sc;
>
> - gcc_assert (useless_type_conversion_p (TREE_TYPE (sc),
> - TREE_TYPE (vectype)));
> + gcc_assert (useless_type_conversion_p (TREE_TYPE (vectype),
> + TREE_TYPE (sc)));
>
> v = VEC_alloc (constructor_elt, gc, nunits);
> for (i = 0; i < nunits; ++i)
The assert is supposed to make sure that in vectorized code vector extracts
use the correct type for assignments to scalars. Thus if we have before
vectorization
scalar = X;
and we vectorized the code that produced X we should use a vector type
for the vector result X that has an element type that is trivially
convertible to that of the above scalar. Thus, before and after
vectorization
useless_type_conversion_p (type-of-scalar, type-of-vector-element-type)
should be true. The scalar X is sc above which is trivially convertible
to scalar, so if type-of-vector-element-type is trivially convertible to
X then it's trivially convertible to scalar.
Thus the assert is correct.
I think treating restrict as ordinary qualifier in make_vector_type is
bogus, similarly not properly maintaining a ref-all "qualification".
I suppose nobody thought of pointer vector element types before.
I'll cook up a patch.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (7 preceding siblings ...)
2011-03-14 10:43 ` rguenth at gcc dot gnu.org
@ 2011-03-14 10:51 ` rguenth at gcc dot gnu.org
2011-03-14 10:58 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 10:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 10:50:57 UTC ---
It doesn't seem to strip ref-all, that isn't a variant kind.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (8 preceding siblings ...)
2011-03-14 10:51 ` rguenth at gcc dot gnu.org
@ 2011-03-14 10:58 ` rguenth at gcc dot gnu.org
2011-03-14 12:22 ` rguenth at gcc dot gnu.org
2011-03-14 12:35 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 10:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 10:58:06 UTC ---
Hm, we also want the elements to be trivially convertible to the vector
element type. So we really want to assert types_compatible_p.
I can't see any real problems with the restrict case in question, apart from
maybe ICEing in a different place. Any "fix" at this point seems to be
more risky than just disabling the assert.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (9 preceding siblings ...)
2011-03-14 10:58 ` rguenth at gcc dot gnu.org
@ 2011-03-14 12:22 ` rguenth at gcc dot gnu.org
2011-03-14 12:35 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 12:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 12:22:32 UTC ---
Author: rguenth
Date: Mon Mar 14 12:20:48 2011
New Revision: 170934
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170934
Log:
2011-03-14 Richard Guenther <rguenther@suse.de>
PR middle-end/48098
* tree.c (build_vector_from_val): Adjust assert to requirements
and reality.
* gcc.dg/torture/pr48098.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/torture/pr48098.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree.c
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
2011-03-12 22:48 [Bug tree-optimization/48098] New: internal compiler error: in build_vector_from_val, at tree.c:1380 schnetter at gmail dot com
` (10 preceding siblings ...)
2011-03-14 12:22 ` rguenth at gcc dot gnu.org
@ 2011-03-14 12:35 ` rguenth at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-03-14 12:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 12:35:29 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 13+ messages in thread