[Bug c++/17333] Optimizing/inlineing

giovannibajo at libero dot it gcc-bugzilla@gcc.gnu.org
Mon Sep 6 11:56:00 GMT 2004


------- Additional Comments From giovannibajo at libero dot it  2004-09-06 11:55 -------
Invalid, because you break strict aliasing rules:

   Free*     first=new(data)Free(&free0,size);

>From this point, you access data of type unsigned[] as type Free. C++ says that 
you cannot access an object (unsigned) through a lvalue of another object 
(Free). This is allowed only with chars. I think changing data[] to char type 
ought to work.

I have not studied in details the code, but writing a memory allocator is often 
impossible without breaking the aliasing rules of C++. You may want to compile 
that very file with -fno-strict-aliasing.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovannibajo at libero dot
                   |                            |it
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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



More information about the Gcc-bugs mailing list