On Fri, Apr 10, 2015 at 05:15:33PM -0700, H.J. Lu wrote: > On Fri, Apr 10, 2015 at 5:06 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > > On Thu, Apr 9, 2015 at 11:28 AM, Marek Polacek <pola...@redhat.com> wrote: > >> This test was failing at -O due to non-trivial conversion at assignment. > >> The reason is that gimple_fold_builtin_memory_op created invalid GIMPLE, > >> because fold_ctor_reference called via fold_const_aggregate_ref was > >> discarding a cast, so it returned a different type than it got. Fixed by > >> dropping useless type conversions only. > >> > >> It also fixes a stale comment that I noticed. > >> > >> Bootstrapped/regtested on x86_64-linux. Preapproved by Jakub on IRC, > >> applying to trunk. > >> > >> 2015-04-09 Marek Polacek <pola...@redhat.com> > >> Jakub Jelinek <ja...@redhat.com> > >> > >> PR middle-end/65554 > >> * gimple-fold.c (gimple_fold_builtin_memory_op): Update comment. > >> (fold_ctor_reference): Use STRIP_USELESS_TYPE_CONVERSION instead > >> of STRIP_NOPS. > >> > >> * g++.dg/opt/pr65554.C: New test. > >> > > > > The testcase failed for 32-bit target: > > > > /export/gnu/import/git/gcc-test-ia32/src-trunk/gcc/testsuite/g++.dg/opt/pr65554.C:47:30: > > fatal error: definition of std::initializer_list does not match > > #include <initializer_list>^M > > compilation terminated.^M > > compiler exited with status 1 > > output is: > > /export/gnu/import/git/gcc-test-ia32/src-trunk/gcc/testsuite/g++.dg/opt/pr65554.C:47:30: > > fatal error: definition of std::initializer_list does not match > > #include <initializer_list>^M > > compilation terminated.^M > > > > FAIL: g++.dg/opt/pr65554.C -std=gnu++11 (test for excess errors) > > This patch fixes it. > > -- > H.J. > --- > diff --git a/gcc/testsuite/g++.dg/opt/pr65554.C > b/gcc/testsuite/g++.dg/opt/pr65554.C > index 70e43a4..1519964 100644 > --- a/gcc/testsuite/g++.dg/opt/pr65554.C > +++ b/gcc/testsuite/g++.dg/opt/pr65554.C > @@ -48,7 +48,7 @@ namespace std > { > typedef _E *const_iterator; > _E *_M_array; > - unsigned long _M_len; > + __SIZE_TYPE__ _M_len; > const_iterator begin () { return _M_array; } > const_iterator end () { return begin () + 1; } > };
Patch is ok. Marek