(Shot in the dark) if anyone has worked on GCC, I'm running into an issue I'm having a hard time fixing.
GCC's constant folding is SO EXTREMELY AGGRESSIVE that I can't get it to acknowledge a Full Call Stack while doing Constant Evaluation. I'm working on something for
consteval int third () { // Line 1
return __builtin_LINE_at(2); // Line 2
} // Line 3
// Line 4, etc ...
consteval int second () {
return third();
}
consteval int first () {
return second();
}
static_assert(first() == 10);
That is, I want to pass in an integer to a compiler builtin that says "walk the call stack that caused you to be evaluated once, so you get the location 2 call stacks above where you are". But the Constant Folder is SO AGGRESSIVE that it just evaluates it in-place, all the time, and getting it to respect the stack has been so unsuccessful. So far I only managed to make it acknowledge one (1) level of stack, but everything else is a deadend.
RrrrRrarharahraaaagh.