[Bug c++/41874] Incorrect "dereferencing type-punned pointer will break strict-aliasing rules" warning

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 6 09:09:00 GMT 2009



------- Comment #1 from pinskia at gcc dot gnu dot org  2009-11-06 09:09 -------
4.5 also fails and I cannot figure why if I do:
#include <new>
struct APInt {
    int i;
};
int main() {
    APInt I;
    void *d;
    char Data[sizeof(APInt)];
    new((void*)Data)APInt();
    d = Data;
    *(APInt*)d = I;
}

GCC does not warn.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-06 09:09:42
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874



More information about the Gcc-bugs mailing list