-
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
ctpg::parser does not build properly with lots of binary operators. Depending on whether the parser is constexpr you see two results:
- If yes, the compiler emits
note: constexpr evaluation hit maximum step limit; possible infinite loop?. The stacktrace afterwards is different depending on how many operators I add, but it is always somewhere insa.analyze_states(). - If no, it will cause a segmentation fault/bus error when entering
ctpg::parser's constructor because it is hitting the stack limit.
If I increase the stack size, then it will run and produce the correct result, but I have to make it absolutely huge (~1024x the default!):
❯ ulimit -s 8388608Default size:
❯ ulimit -s
8192Library version used:
❯ yay ctpg
1 aur/ctpg-git 1.3.7.r12.g0482730-1 (+0 0.00) (Installed: 1.3.7.r14.g624b4d1-1Compiler used:
❯ clang++ --version
clang version 20.1.8
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/binExample to reproduce:
#include <ctpg/ctpg.hpp>
constexpr ctpg::nterm<std::string> expr{"expr"};
static constexpr ctpg::parser p(
expr,
ctpg::terms(
"+=",
"-=",
"*=",
"/=",
"<<=",
">>=",
"<<",
">>",
"<",
">",
"<=",
">=",
"==",
"!=",
"&",
"|",
"^",
"&&",
"||",
"+",
"-",
"*",
"/",
"%",
"x"
),
ctpg::nterms(expr),
ctpg::rules(
expr(expr, "+=", expr) >>= std::identity{},
expr(expr, "-=", expr) >>= std::identity{},
expr(expr, "*=", expr) >>= std::identity{},
expr(expr, "/=", expr) >>= std::identity{},
expr(expr, "<<=", expr) >>= std::identity{},
expr(expr, ">>=", expr) >>= std::identity{},
expr(expr, "<<", expr) >>= std::identity{},
expr(expr, ">>", expr) >>= std::identity{},
expr(expr, "<", expr) >>= std::identity{},
expr(expr, ">", expr) >>= std::identity{},
expr(expr, "<=", expr) >>= std::identity{},
expr(expr, ">=", expr) >>= std::identity{},
expr(expr, "==", expr) >>= std::identity{},
expr(expr, "!=", expr) >>= std::identity{},
expr(expr, "&", expr) >>= std::identity{},
expr(expr, "|", expr) >>= std::identity{},
expr(expr, "^", expr) >>= std::identity{},
expr(expr, "&&", expr) >>= std::identity{},
expr(expr, "||", expr) >>= std::identity{},
expr(expr, "+", expr) >>= std::identity{},
expr(expr, "-", expr) >>= std::identity{},
expr(expr, "*", expr) >>= std::identity{},
expr(expr, "/", expr) >>= std::identity{},
expr(expr, "%", expr) >>= std::identity{},
expr("x") >>= std::identity{}
)
);Metadata
Metadata
Assignees
Labels
No labels