From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25882 invoked by alias); 19 Apr 2007 23:45:08 -0000 Received: (qmail 25714 invoked by uid 48); 19 Apr 2007 23:44:58 -0000 Date: Thu, 19 Apr 2007 23:45:00 -0000 Subject: [Bug libstdc++/31638] New: [4.0/4.1/4.2/4.3 Regression] string usage leads to warning with -Wcast-align X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tbm at cyrius dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg01490.txt.bz2 [ Forwarded from http://bugs.debian.org/382153 This issue has been reported by Margarita Manterola who also provided the testcase ] If you compile the following testcase with -Wcast-align you get a warning on certain architectures, including alpha, arm, hppa, ia64 and sparc. I've verified this on ia64 with gcc 4.0, 4.1 and 4.3. 3.3 and 3.4 don't show this warning. The warning goes away when you include in addition to . tbm@coconut0:~/src$ /usr/lib/gcc-snapshot/bin/g++ -Wcast-align x.c /usr/lib/gcc-snapshot/lib/gcc/ia64-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/basic_string.h: In member function 'std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT, _Traits, _Alloc>::_M_rep() const [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]': /usr/lib/gcc-snapshot/lib/gcc/ia64-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/basic_string.h:496: instantiated from 'std::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]' x.c:6: instantiated from here /usr/lib/gcc-snapshot/lib/gcc/ia64-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/basic_string.h:288: warning: cast from 'char*' to 'std::basic_string, std::allocator >::_Rep*' increases required alignment of target type Testcase: #include using namespace std; int main (int argc, char **argv) { string hi; hi = "Hi"; return 0; } -- Summary: [4.0/4.1/4.2/4.3 Regression] string usage leads to warning with -Wcast-align Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tbm at cyrius dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31638