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

* [Bug libstdc++/31638] [4.0/4.1/4.2/4.3 Regression] string usage leads to warning with -Wcast-align
  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 ` pinskia at gcc dot gnu dot org
  2007-04-20  7:50 ` pcarlini at suse dot de
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-19 23:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-04-20 00:49 -------
I think this is really the same as PR 19495.


-- 


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


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

* [Bug libstdc++/31638] [4.0/4.1/4.2/4.3 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-04-20  7:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pcarlini at suse dot de  2007-04-20 08:50 -------
I will check, but I don't think this can possibly happen in mainline, after we
fixed c++/30500. Otherwise, the underlying issue is libstdc++/19495, of course.


-- 


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


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

* [Bug libstdc++/31638] [4.0/4.1/4.2 Regression] string usage leads to warning with -Wcast-align
  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 ` pcarlini at suse dot de
  2007-04-22 10:13 ` tbm at cyrius dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-04-22  0:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pcarlini at suse dot de  2007-04-22 01:19 -------
In fact, the problem cannot be reproduced on ia64, with current mainline. I
agree that the warning can be very annoying (the underlying issue was already
there before 4.0 and will be there until we break the ABI), therefore I would
be in favor of porting the fix for C++/30500, very small and non-invasive,
IMHO, to 4_2-branch, let's ask Mark.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pcarlini at suse dot de,
                   |                            |mark at codesourcery dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-22 01:19:04
               date|                            |
            Summary|[4.0/4.1/4.2/4.3 Regression]|[4.0/4.1/4.2 Regression]
                   |string usage leads to       |string usage leads to
                   |warning with -Wcast-align   |warning with -Wcast-align


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


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

* [Bug libstdc++/31638] [4.0/4.1/4.2 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tbm at cyrius dot com @ 2007-04-22 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from tbm at cyrius dot com  2007-04-22 11:13 -------
(In reply to comment #3)
> In fact, the problem cannot be reproduced on ia64, with current mainline.

I tried revision 123217, just a few revisions before C++/30500.  Glad to
hear it's no longer there.


-- 


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


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

* [Bug libstdc++/31638] [4.0/4.1/4.2 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (3 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mark at codesourcery dot com @ 2007-04-23  1:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mark at codesourcery dot com  2007-04-23 02:19 -------
Subject: Re:  [4.0/4.1/4.2 Regression] string usage leads
 to warning with -Wcast-align

pcarlini at suse dot de wrote:
> ------- Comment #3 from pcarlini at suse dot de  2007-04-22 01:19 -------
> In fact, the problem cannot be reproduced on ia64, with current mainline. I
> agree that the warning can be very annoying (the underlying issue was already
> there before 4.0 and will be there until we break the ABI), therefore I would
> be in favor of porting the fix for C++/30500, very small and non-invasive,
> IMHO, to 4_2-branch, let's ask Mark.

It is OK with me.

Thanks,


-- 


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


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

* [Bug libstdc++/31638] [4.0/4.1/4.2 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-04-23 12:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pcarlini at suse dot de  2007-04-23 13:36 -------
Created an attachment (id=13430)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13430&action=view)
Patch for 4_2-branch


-- 


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


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

* [Bug libstdc++/31638] [4.0/4.1/4.2 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-04-23 12:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2007-04-23 13:35 -------
(In reply to comment #5)
> It is OK with me.

Ok, excellent. For 4_2-branch we have a nuisance, in that the original testcase
involves -Wconversion which in that branch does nothing in C++. Thus I tested
on ia64-linux the attached, which adds a new test. If requested I can add it to
mainline too, otherwise I will simply commit to the branch and close this PR.


-- 


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


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

* [Bug libstdc++/31638] [4.0/4.1 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (6 preceding siblings ...)
  2007-04-23 12:36 ` pcarlini at suse dot de
@ 2007-04-24 22:39 ` pcarlini at suse dot de
  2007-04-24 23:06 ` pcarlini at suse dot de
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-04-24 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pcarlini at suse dot de  2007-04-24 23:39 -------
Problem solved in 4_2-branch too via fixing C++/30500. Nothing will be done in
older branches.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.0/4.1/4.2 Regression]    |[4.0/4.1 Regression] string
                   |string usage leads to       |usage leads to warning with
                   |warning with -Wcast-align   |-Wcast-align


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


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

* [Bug libstdc++/31638] [4.0/4.1 Regression] string usage leads to warning with -Wcast-align
  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
                   ` (7 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2007-04-24 23:06 UTC (permalink / raw)
  To: gcc-bugs



-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0


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).