This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77340] New: Invalid (Stack Smashing) Code Generated In Simple Cases With Debug-Mode Vectors


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

            Bug ID: 77340
           Summary: Invalid (Stack Smashing) Code Generated In Simple
                    Cases With Debug-Mode Vectors
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at geometrian dot com
  Target Milestone: ---

Simple test case:

    //func.hpp
    #define _GLIBCXX_DEBUG
    #include <vector>
    std::vector<int> func();

    //func.cpp
    #include "func.hpp"
    std::vector<int> func() { return std::vector<int>(); }

    //main.cpp
    #include <cstdio> //Necessary to cause error
    #include "func.hpp"
    int main(int /*argc*/, char* /*argv*/[]) {
        func(); return 0;
    }

Compile with "g++ *.cpp" and run ("./a.out").  Produces:

    *** stack smashing detected ***: ./a.out terminated
    Aborted (core dumped)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]