public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/31638]  New: [4.0/4.1/4.2/4.3 Regression] string usage leads to warning with -Wcast-align
@ 2007-04-19 23:45 tbm at cyrius dot com
  2007-04-19 23:49 ` [Bug libstdc++/31638] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tbm at cyrius dot com @ 2007-04-19 23:45 UTC (permalink / raw)
  To: gcc-bugs

[ 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 <iostream> in
addition to <string>.


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<char>, _Alloc = std::allocator<char>]':
/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<char>,
_Alloc = std::allocator<char>]'
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<char, std::char_traits<char>,
std::allocator<char> >::_Rep*' increases required alignment of target type

Testcase:

#include <string>

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-04-24 23:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-19 23:45 [Bug libstdc++/31638] New: [4.0/4.1/4.2/4.3 Regression] string usage leads to warning with -Wcast-align tbm at cyrius dot com
2007-04-19 23:49 ` [Bug libstdc++/31638] " pinskia at gcc dot gnu dot org
2007-04-20  7:50 ` pcarlini at suse dot de
2007-04-22  0:19 ` [Bug libstdc++/31638] [4.0/4.1/4.2 " pcarlini at suse dot de
2007-04-22 10:13 ` tbm at cyrius dot com
2007-04-23  1:19 ` mark at codesourcery dot com
2007-04-23 12:36 ` pcarlini at suse dot de
2007-04-23 12:36 ` pcarlini at suse dot de
2007-04-24 22:39 ` [Bug libstdc++/31638] [4.0/4.1 " pcarlini at suse dot de
2007-04-24 23:06 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).