Join Nostr
2026-06-19 16:47:42 UTC

Björkus "No time_t to Die" Dorkus on Nostr: (Shot in the dark) if anyone has worked on GCC, I'm running into an issue I'm having ...

(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<code>consteval int third () { // Line 1<br> return __builtin_LINE_at(2); // Line 2<br>} // Line 3<br>// Line 4, etc ...<br>consteval int second () {<br> return third();<br>}<br><br>consteval int first () {<br> return second();<br>}<br><br>static_assert(first() == 10);<br></code>

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.