[PATCH] Fix __cxa_exception ABI breakage in 4.4 (PR libstdc++/38732)

Paolo Carlini paolo.carlini@oracle.com
Wed Jan 7 17:54:00 GMT 2009


Hi,

and thanks for testing...
> unwind-cxx.h isn't exported header, so only libsupc++ building matters.
> With -Wstrict-aliasing{,=2,=3} no warnings are reported, with
> -O2 -D_GNU_SOURCE -Wstrict-aliasing=1
> In file included from ../../../../libstdc++-v3/libsupc++/eh_alloc.cc:41:
> ../../../../libstdc++-v3/libsupc++/unwind-cxx.h: In function ‘__cxxabiv1::__cxa_exception* __cxxabiv1::__get_exception_header_from_ue(_Unwind_Exception*)’:
> ../../../../libstdc++-v3/libsupc++/unwind-cxx.h:232: warning: dereferencing type-punned pointer might break strict-aliasing rules
> ../../../../libstdc++-v3/libsupc++/unwind-cxx.h: In function ‘__cxxabiv1::__cxa_refcounted_exception* __cxxabiv1::__get_refcounted_exception_header_from_ue(_Unwind_Exception*)’:
> ../../../../libstdc++-v3/libsupc++/unwind-cxx.h:247: warning: dereferencing type-punned pointer might break strict-aliasing rules
> ../../../../libstdc++-v3/libsupc++/unwind-cxx.h: In function ‘__cxxabiv1::__cxa_dependent_exception* __cxxabiv1::__get_dependent_exception_from_ue(_Unwind_Exception*)’:
> ../../../../libstdc++-v3/libsupc++/unwind-cxx.h:253: warning: dereferencing type-punned pointer might break strict-aliasing rules
> but two of the 3 warnings are preexisting.  Yet I fail to see how
> it violates strict aliasing.  We have:
> struct A { ... struct B { ... struct C { ... }; }; };
> and just do some up/downcasts.
>   
hummm, of course libstdc++/38477 immediately comes to my mind. Richard,
is it possible those warnings are of the same (spurious ;) kind?
> Either we cast pointers to the end of all of these (the same) to
> one of these structs, subtract one and then dereference fields in it,
> or first add 1 to pointer to one of these structs (to get to the end)
> and then cat/subtract.
>   
I see, if you could experiment a bit with that...

Paolo.



More information about the Gcc-patches mailing list