This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR libstdc++/85930 fix misaligned reference


On 04/06/18 17:06 +0100, Jonathan Wakely wrote:
	PR libstdc++/85930
	* include/bits/shared_ptr_base.h (_Sp_make_shared_tag::_S_ti): Align
	the static variable correctly.


And _really_ align it this time, so the alignment-specifier isn't
ignored (with the warning suppressed because it's a system header).

Tested powerpc64le-linux, committed to trunk.

commit 1efe054e03151e0fb53cacb937979f238e531ae1
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 4 22:25:50 2018 +0100

    PR libstdc++/85930 fix misplaced alignment-specifier
    
            PR libstdc++/85930
            * include/bits/shared_ptr_base.h [!__cpp_rtti]: Include <typeinfo>
            unconditionally. Remove redundant declaration.
            [!__cpp_rtti] (_Sp_make_shared_tag::_S_ti): Fix location of
            alignment-specifier.

diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 22cb7eb46b1..6c5089afdda 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -49,9 +49,7 @@
 #ifndef _SHARED_PTR_BASE_H
 #define _SHARED_PTR_BASE_H 1
 
-#if __cpp_rtti
-# include <typeinfo>
-#endif
+#include <typeinfo>
 #include <bits/allocated_ptr.h>
 #include <bits/refwrap.h>
 #include <bits/stl_function.h>
@@ -59,10 +57,6 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
-#if !__cpp_rtti
-  class type_info;
-#endif
-
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if _GLIBCXX_USE_DEPRECATED
@@ -516,7 +510,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     static const type_info&
     _S_ti() noexcept
     {
-      static constexpr alignas(type_info) _Sp_make_shared_tag __tag;
+      alignas(type_info) static constexpr _Sp_make_shared_tag __tag;
       return reinterpret_cast<const type_info&>(__tag);
     }
 #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]