public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67058] New: Segmentation fault: 11 with >= in lambda in c++11
@ 2015-07-29 16:31 mars.lenjoy at gmail dot com
  2015-07-29 16:35 ` [Bug c++/67058] " trippels at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: mars.lenjoy at gmail dot com @ 2015-07-29 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67058

            Bug ID: 67058
           Summary: Segmentation fault: 11 with >= in lambda in c++11
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mars.lenjoy at gmail dot com
  Target Milestone: ---

I filed this because I assume this is not a deprecated version.
This is the current g++ in my OS X 10.9.5

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

<code>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;

int main() {
  vector<pair<string, int>> vec2 = {
    pair<string, int>("aaa", 3),
    pair<string, int>("baaa", 4),
    pair<string, int>("bbaaa", 5),
    pair<string, int>("bbaac", 5),
    pair<string, int>("bbbaaa", 6),
    pair<string, int>("cccddd", 6),
    pair<string, int>("ddd", 3)};

  sort(vec2.begin(), vec2.end(),
       [](const pair<string, int> &p1, const pair<string, int> &p2) {
         cout << p1.second << " vs " << p2.second << endl;
         // No problem with ">"
         // if (p1.second > p2.second) { return true; }

         // Segmentation fault: 11 with ">=",
         // it's related to the data in vec2.
         if (p1.second >= p2.second) { return true; }

         return false;
       });

  for (const auto &p : vec2) {
    cout << p.first << ", " << p.second << endl;
  }
  cout << endl;
}

</code>

$ g++ test.cpp -std=c++11
$ ./a.out


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

* [Bug c++/67058] Segmentation fault: 11 with >= in lambda in c++11
  2015-07-29 16:31 [Bug c++/67058] New: Segmentation fault: 11 with >= in lambda in c++11 mars.lenjoy at gmail dot com
@ 2015-07-29 16:35 ` trippels at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-07-29 16:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67058

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |trippels at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
This is an LLVM bug.


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

end of thread, other threads:[~2015-07-29 16:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 16:31 [Bug c++/67058] New: Segmentation fault: 11 with >= in lambda in c++11 mars.lenjoy at gmail dot com
2015-07-29 16:35 ` [Bug c++/67058] " trippels at gcc dot gnu.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).