[Bug c++/56564] movdqa on possibly-8-byte-aligned struct with -O3

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 8 10:01:00 GMT 2013


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2013-03-08
            Summary|[4.7 Regression] movdqa on  |movdqa on
                   |possibly-8-byte-aligned     |possibly-8-byte-aligned
                   |struct with -O3             |struct with -O3
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.4, 4.7.2, 4.8.0

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-08 10:00:54 UTC ---
This instruction appears in an EH region of function

_ZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEv

(AFAIK).  It's defined twice, once weak and aligned 8 and once strong
and aligned 16, so AFAIK it _is_ aligned properly.

        .align 8
        .type  
_ZGVZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep,
@gnu_unique_object
        .size  
_ZGVZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep,
8
_ZGVZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep:
        .zero   8
        .weak  
_ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep
        .section       
.bss._ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep,"awG",@nobits,_ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep,comdat
        .align 16
        .type  
_ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep,
@gnu_unique_object
        .size  
_ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep,
16
_ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep:
        .zero   16

and readelf shows:

  [192] .bss._ZZN5boost16 NOBITS           0000000000000000  00001ca0
       0000000000000010  0000000000000000 WAG       0     0     16

with alignment of 16.

> This crashes if
>_ZZN5boost16exception_detail27get_static_exception_objectINS0_10bad_alloc_EEENS_13exception_ptrEvE2ep
> comes from another object file where it is declared with 8-byte alignment.

so this would be a bug and a violation of ODR(?)

What's this "other object file"?

The code piece in question is:

        template <class Exception>
        exception_ptr
        get_static_exception_object()
            {
            Exception ba;
            exception_detail::clone_impl<Exception> c(ba);
            static exception_ptr ep(shared_ptr<exception_detail::clone_base
const>(new exception_detail::clone_impl<Exception>(c)));
            return ep;
            }

OTOH, not sure what increases the alignment of that object from it's
type-alignmend.

Same alignment is emitted with 4.8 and also 4.6 - so you must be unlucky
with that other object file (compiled with which compiler?)

Please also attach preprocessed source of the "other object file"



More information about the Gcc-bugs mailing list