[PATCH v3] Add strict aliasing warning when inlining function.

lin zuojian manjian2006@gmail.com
Wed Aug 20 10:48:00 GMT 2014


Hi,
    And I have run test like this:
     make check-g++ RUNTESTFLAGS="dg.exp"
    And turned out there are 3 more unexpected failures like
    g++.dg/opt/pmf1.C
/home/linzj/src/build-gcc/gcc-trunk/gcc/testsuite/g++.dg/opt/pmf1.C: In function ‘int main()’:
/home/linzj/src/build-gcc/gcc-trunk/gcc/testsuite/g++.dg/opt/pmf1.C:72:42: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     t.forward(itemfunptr, &Item::fred, 1);
                                          ^
/home/linzj/src/build-gcc/gcc-trunk/gcc/testsuite/g++.dg/opt/pmf1.C:72:42: warning: during inlining function void WorldObject<Derived>::forward(memfunT, arg1T, arg2T) [with memfunT = void (Container::*)(void (Item::*)(int), int); arg1T = void (Item::*)(int); arg2T = int; Derived = Container] into function int main() [-Wstrict-aliasing]
FAIL: g++.dg/opt/pmf1.C  -std=gnu++98 (test for excess errors)
PASS: g++.dg/opt/pmf1.C  -std=gnu++98 execution test
FAIL: g++.dg/opt/pmf1.C  -std=gnu++11 (test for excess errors)
PASS: g++.dg/opt/pmf1.C  -std=gnu++11 execution test
FAIL: g++.dg/opt/pmf1.C  -std=gnu++1y (test for excess errors) 
    
    I think it's okay to fix this test. And commit my code.
---
Lin Zuojian



More information about the Gcc-patches mailing list