public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28553]  New: string processing -O3 optimization bug under GCC 4.1.1
@ 2006-07-31 17:55 peter at chocky dot org
  2006-07-31 17:56 ` [Bug c++/28553] " peter at chocky dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: peter at chocky dot org @ 2006-07-31 17:55 UTC (permalink / raw)
  To: gcc-bugs

Note, the following is in reference to this Debian version of GCC:

gcc version 4.1.2 20060729 (prerelease) (Debian 4.1.1-10)

However, it also occurs under a version I have built myself:

Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.1
--enable-languages=c,c++,java
Thread model: posix
gcc version 4.1.1


My C++ knowledge isn't extensive enough to give further details of this other
than it's related to string handling, or guess if it's already been reported,
but the following preprocessed code reproduces the problem under -O3, but not
-O2.  The code performs correctly under GCC 3.4.6 and -O3

Here is the expected output:

op [0]: "A"
op [1]: "B"
op [2]: "C"
op [3]: "D"
op [4]: "E"
op [5]: "F"

Here is a crash caught by GDB:

CfgSchema (this=0xbfd0a400, schema_str=@0xbfd0a40c) at
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:260
260               if (__pred(*__first))
(gdb) bt
#0  CfgSchema (this=0xbfd0a400, schema_str=@0xbfd0a40c) at
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:260
#1  0x08048ebe in main () at cfgtblopt.cpp:36


-- 
           Summary: string processing -O3 optimization bug under GCC 4.1.1
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peter at chocky dot org
  GCC host triplet: i486-linux-gnu


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


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

* [Bug c++/28553] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
@ 2006-07-31 17:56 ` peter at chocky dot org
  2006-08-01 12:03 ` pcarlini at suse dot de
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: peter at chocky dot org @ 2006-07-31 17:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from peter at chocky dot org  2006-07-31 17:56 -------
Created an attachment (id=11981)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11981&action=view)
Preprocessed C++ demonstrating problem


-- 


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


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

* [Bug c++/28553] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
  2006-07-31 17:56 ` [Bug c++/28553] " peter at chocky dot org
@ 2006-08-01 12:03 ` pcarlini at suse dot de
  2006-08-01 12:18 ` [Bug c++/28553] [4.1 Regression] " rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pcarlini at suse dot de @ 2006-08-01 12:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pcarlini at suse dot de  2006-08-01 12:02 -------
The problem cannot be reproduced in mainline, only in 4_1-branch. Seems an
rtl-optimization bug: for the below slightly reduced testcase t97.final_cleanup
is identical in mainline and 4_1-branch:

#include <string>
#include <algorithm>

template<typename InputIter, typename SplitPred>
  inline
  void
  SplitTo(InputIter b, InputIter e, SplitPred sp)
  {
    InputIter p = std::find_if(b, e, sp);

    while (p != e)
      {
        b = p;
        p = std::find_if(b, e, sp);
      }
  }

template<typename InputIter>
  inline
  void
  SplitTo(InputIter b, InputIter e)
  { SplitTo(b, e, std::bind2nd(std::equal_to<char>(), ';')); }

int
main(void)
{
  const std::string& src = "";
  SplitTo(src.begin(), src.end());
}


-- 


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
  2006-07-31 17:56 ` [Bug c++/28553] " peter at chocky dot org
  2006-08-01 12:03 ` pcarlini at suse dot de
@ 2006-08-01 12:18 ` rguenth at gcc dot gnu dot org
  2006-08-24  1:53 ` bangerth at dealii dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-08-01 12:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-08-01 12:18 -------
-O2 -finline-functions is sufficient to reproduce the problem on the branch, or
if you mark CfgSchema::CfgSchema(const std::string &) 'inline'.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
           Keywords|                            |wrong-code
      Known to fail|                            |4.1.0 4.1.1
      Known to work|                            |4.0.3 4.2.0
            Summary|string processing -O3       |[4.1 Regression] string
                   |optimization bug under GCC  |processing -O3 optimization
                   |4.1.1                       |bug under GCC 4.1.1
   Target Milestone|---                         |4.1.2


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (2 preceding siblings ...)
  2006-08-01 12:18 ` [Bug c++/28553] [4.1 Regression] " rguenth at gcc dot gnu dot org
@ 2006-08-24  1:53 ` bangerth at dealii dot org
  2006-10-27  9:41 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2006-08-24  1:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bangerth at dealii dot org  2006-08-24 01:52 -------
Paolo has already confirmed this one.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-24 01:52:50
               date|                            |


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (3 preceding siblings ...)
  2006-08-24  1:53 ` bangerth at dealii dot org
@ 2006-10-27  9:41 ` rguenth at gcc dot gnu dot org
  2006-11-01 18:17 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-27  9:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-10-27 09:41 -------
I cannot reproduce this with 4.1.2 20061024 anymore.


-- 


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (4 preceding siblings ...)
  2006-10-27  9:41 ` rguenth at gcc dot gnu dot org
@ 2006-11-01 18:17 ` mmitchel at gcc dot gnu dot org
  2006-11-02 16:34 ` peter at chocky dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-11-01 18:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from mmitchel at gcc dot gnu dot org  2006-11-01 18:16 -------
Can the original submitter still reproduce this problem?


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (5 preceding siblings ...)
  2006-11-01 18:17 ` mmitchel at gcc dot gnu dot org
@ 2006-11-02 16:34 ` peter at chocky dot org
  2006-12-06 17:37 ` peter at chocky dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: peter at chocky dot org @ 2006-11-02 16:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from peter at chocky dot org  2006-11-02 16:34 -------
I can confirm that this is fixed with the GCC 4.1 now in Debian unstable.


-- 

peter at chocky dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (6 preceding siblings ...)
  2006-11-02 16:34 ` peter at chocky dot org
@ 2006-12-06 17:37 ` peter at chocky dot org
  2007-01-25  6:01 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: peter at chocky dot org @ 2006-12-06 17:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from peter at chocky dot org  2006-12-06 17:37 -------
And it's back, at least in this version:

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-4.1
--enable-languages=c,c++,java
Thread model: posix
gcc version 4.1.2 20061204 (prerelease)


-- 

peter at chocky dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (7 preceding siblings ...)
  2006-12-06 17:37 ` peter at chocky dot org
@ 2007-01-25  6:01 ` mmitchel at gcc dot gnu dot org
  2007-02-14  9:06 ` mmitchel at gcc dot gnu dot org
  2008-07-04 15:46 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-01-25  6:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (8 preceding siblings ...)
  2007-01-25  6:01 ` mmitchel at gcc dot gnu dot org
@ 2007-02-14  9:06 ` mmitchel at gcc dot gnu dot org
  2008-07-04 15:46 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:06 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug c++/28553] [4.1 Regression] string processing -O3 optimization bug under GCC 4.1.1
  2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
                   ` (9 preceding siblings ...)
  2007-02-14  9:06 ` mmitchel at gcc dot gnu dot org
@ 2008-07-04 15:46 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jsm28 at gcc dot gnu dot org  2008-07-04 15:46 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
      Known to fail|4.1.0 4.1.1 4.1.2           |4.1.0 4.1.1 4.1.2 4.1.3
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.0


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


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

end of thread, other threads:[~2008-07-04 15:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-31 17:55 [Bug c++/28553] New: string processing -O3 optimization bug under GCC 4.1.1 peter at chocky dot org
2006-07-31 17:56 ` [Bug c++/28553] " peter at chocky dot org
2006-08-01 12:03 ` pcarlini at suse dot de
2006-08-01 12:18 ` [Bug c++/28553] [4.1 Regression] " rguenth at gcc dot gnu dot org
2006-08-24  1:53 ` bangerth at dealii dot org
2006-10-27  9:41 ` rguenth at gcc dot gnu dot org
2006-11-01 18:17 ` mmitchel at gcc dot gnu dot org
2006-11-02 16:34 ` peter at chocky dot org
2006-12-06 17:37 ` peter at chocky dot org
2007-01-25  6:01 ` mmitchel at gcc dot gnu dot org
2007-02-14  9:06 ` mmitchel at gcc dot gnu dot org
2008-07-04 15:46 ` jsm28 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).