On Wed, 7 Sep 2016, Yvan Roux wrote: > Hi Richard, > > On 6 September 2016 at 14:41, Richard Biener <rguent...@suse.de> wrote: > > > > The following fixes PR77450. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. > > > > Richard. > > > > 2016-09-06 Richard Biener <rguent...@suse.de> > > > > PR c/77450 > > c-family/ > > * c-common.c (c_common_mark_addressable_vec): Handle > > COMPOUND_LITERAL_EXPR. > > > > * c-c++-common/vector-subscript-7.c: Adjust. > > * c-c++-common/vector-subscript-8.c: New testcase. > > This new testcase fails in our validation (ARM and x86 targets): > > gcc/testsuite/c-c++-common/vector-subscript-8.c:8:17: error: lvalue > required as left operand of assignment > compiler exited with status 1 > FAIL: c-c++-common/vector-subscript-8.c -std=c++98 (test for excess errors)
Ah, seems my dev tree eats the NON_LVALUE_EXPR we build around it. So it looks like the testcase is invalid for C++, will move it. Richard. > > > Index: gcc/c-family/c-common.c > > =================================================================== > > --- gcc/c-family/c-common.c (revision 240004) > > +++ gcc/c-family/c-common.c (working copy) > > @@ -10918,7 +10918,9 @@ c_common_mark_addressable_vec (tree t) > > { > > while (handled_component_p (t)) > > t = TREE_OPERAND (t, 0); > > - if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL) > > + if (!VAR_P (t) > > + && TREE_CODE (t) != PARM_DECL > > + && TREE_CODE (t) != COMPOUND_LITERAL_EXPR) > > return; > > TREE_ADDRESSABLE (t) = 1; > > } > > Index: gcc/testsuite/c-c++-common/vector-subscript-7.c > > =================================================================== > > --- gcc/testsuite/c-c++-common/vector-subscript-7.c (revision 240004) > > +++ gcc/testsuite/c-c++-common/vector-subscript-7.c (working copy) > > @@ -1,5 +1,5 @@ > > /* { dg-do compile } */ > > -/* { dg-options "-O -fdump-tree-ccp1" } */ > > +/* { dg-options "-O -fdump-tree-fre1" } */ > > > > typedef int v4si __attribute__ ((vector_size (16))); > > > > @@ -11,4 +11,4 @@ main (int argc, char** argv) > > return ((v4si){1, 2, 42, 0})[j]; > > } > > > > -/* { dg-final { scan-tree-dump "return 42;" "ccp1" } } */ > > +/* { dg-final { scan-tree-dump "return 42;" "fre1" } } */ > > Index: gcc/testsuite/c-c++-common/vector-subscript-8.c > > =================================================================== > > --- gcc/testsuite/c-c++-common/vector-subscript-8.c (revision 0) > > +++ gcc/testsuite/c-c++-common/vector-subscript-8.c (working copy) > > @@ -0,0 +1,9 @@ > > +/* { dg-do compile } */ > > + > > +typedef int V __attribute__((vector_size(4))); > > + > > +void > > +foo(void) > > +{ > > + (V){ 0 }[0] = 0; > > +} > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)