public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35652]  New: Location information incorrect on string bounds warning
@ 2008-03-20 21:07 simon_baldwin at yahoo dot com
  2008-03-21 12:50 ` [Bug c++/35652] " rguenth at gcc dot gnu dot org
                   ` (37 more replies)
  0 siblings, 38 replies; 40+ messages in thread
From: simon_baldwin at yahoo dot com @ 2008-03-20 21:07 UTC (permalink / raw)
  To: gcc-bugs

The following demonstrates a location error in a string bounds warning message:

$ cat /tmp/c.cc
#include <string>
int main() {
  // blank line padding, could also be code...
  //
  //
  //
  //
  //
  //
  //
  //
  //
  std::string s = "";
  s += 'x' + "y";  // bogus
}

$ g++ -O2 -c /tmp/c.cc
/tmp/c.cc: In function 'int main()':
/tmp/c.cc:2: warning: offset outside bounds of constant string
/tmp/c.cc:2: warning: offset outside bounds of constant string
/tmp/c.cc:2: warning: offset outside bounds of constant string
/tmp/c.cc:2: warning: offset outside bounds of constant string
/tmp/c.cc:2: warning: offset outside bounds of constant string
/.../i686-unknown-linux-gnu/include/c++/4.3.0/bits/char_traits.h:262: warning:
offset outside bounds of constant string
/.../i686-unknown-linux-gnu/include/c++/4.3.0/bits/char_traits.h:262: warning:
offset outside bounds of constant string

The erroneous line is line 14, but g++ reports the problem (multiple times) at
line 2 and in an STL header file.  The same behavior occurs in g++ 4.2.1,
4.1.1, 4.0.3, and 4.0.2.  It does not occur in gcc 3.4.5.

Also, there is no warning emitted with -O0, for some reason.


-- 
           Summary: Location information incorrect on string bounds warning
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com


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


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

end of thread, other threads:[~2010-02-03 16:29 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-20 21:07 [Bug c++/35652] New: Location information incorrect on string bounds warning simon_baldwin at yahoo dot com
2008-03-21 12:50 ` [Bug c++/35652] " rguenth at gcc dot gnu dot org
2008-03-21 12:53 ` [Bug c++/35652] [4.1/4.2/4.3/4.4 Regression] " rguenth at gcc dot gnu dot org
2008-03-21 13:02 ` rguenth at gcc dot gnu dot org
2008-04-26 17:01 ` simonb at gcc dot gnu dot org
2008-04-26 17:22 ` simon_baldwin at yahoo dot com
2008-04-26 20:53 ` rguenth at gcc dot gnu dot org
2008-07-04 22:41 ` [Bug c++/35652] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2008-10-30 22:46 ` [Bug c++/35652] [4.2/4.3/4.4 Regression] offset warning should be given in the front-end manu at gcc dot gnu dot org
2008-11-01 17:46 ` manu at gcc dot gnu dot org
2008-11-02 12:22 ` rguenther at suse dot de
2008-11-02 12:54 ` manu at gcc dot gnu dot org
2008-11-02 13:07   ` Andrew Thomas Pinski
2008-11-02 13:04 ` rguenth at gcc dot gnu dot org
2008-11-02 13:09 ` pinskia at gmail dot com
2009-02-03 16:40 ` bonzini at gnu dot org
2009-02-08 15:46 ` manu at gcc dot gnu dot org
2009-03-27  7:17 ` andreasmeier80 at gmx dot de
2009-03-27 12:53 ` hjl at gcc dot gnu dot org
2009-03-27 14:31 ` [Bug c++/35652] [4.2/4.3 " dominiq at lps dot ens dot fr
2009-03-27 14:34 ` rguenth at gcc dot gnu dot org
2009-03-27 14:44 ` dominiq at lps dot ens dot fr
2009-03-27 14:50 ` dominiq at lps dot ens dot fr
2009-03-27 15:13 ` dominiq at lps dot ens dot fr
2009-03-30 13:51 ` jakub at gcc dot gnu dot org
2009-03-30 17:42 ` jakub at gcc dot gnu dot org
2009-03-31 13:11 ` espindola at google dot com
2009-03-31 13:12 ` espindola at google dot com
2009-03-31 20:49 ` [Bug c++/35652] [4.3 " jsm28 at gcc dot gnu dot org
2009-04-11 17:01 ` rob1weld at aol dot com
2009-04-14 14:51 ` pinskia at gcc dot gnu dot org
2009-04-15  7:41 ` dcb314 at hotmail dot com
2009-04-28  4:57 ` bje at gcc dot gnu dot org
2009-08-04 12:40 ` rguenth at gcc dot gnu dot org
2009-08-04 23:42 ` [Bug c++/35652] [4.3/4.4/4.5 " manu at gcc dot gnu dot org
2009-12-20 18:09 ` jason at gcc dot gnu dot org
2009-12-20 18:50 ` jakub at gcc dot gnu dot org
2010-02-03  5:24 ` jason at gcc dot gnu dot org
2010-02-03 16:28 ` jason at gcc dot gnu dot org
2010-02-03 16:29 ` jason at gcc dot gnu dot org

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