Skip to content

for loop crashes the kernel #85

Open
@Vipul-Cariappa

Description

@Vipul-Cariappa

EDITED:
Any for loop crashes the kernel. Example:

In [1]: for (int i = 0; i < 5; i++) {}

ORIGINAL ISSUE FILED:

The following code snippet crashes the kernel with 11, 14 & 17 stdc++:

In [1]: #include <iostream>
   ...: #include <string>
   ...: #include <vector>

In [2]: std::vector<std::string> strs;
   ...: strs.push_back("xeus");
   ...: strs.push_back("clang");
   ...: strs.push_back("repl");

In [3]: for (size_t i = 0; i < strs.size(); i++) {
   ...:     std::cout << strs.at(i) << std::endl;
   ...: }

But the following runs fine:

In [1]: #include <iostream>
   ...: #include <string>
   ...: #include <vector>

In [2]: std::vector<std::string> strs;
   ...: strs.push_back("xeus");
   ...: strs.push_back("clang");
   ...: strs.push_back("repl");

In [3]: std::cout << strs.at(0) << std::endl;
   ...: std::cout << strs.at(1) << std::endl;
   ...: std::cout << strs.at(2) << std::endl;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions