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.
Published at
2026-06-19 16:47:42 UTCEvent JSON
{
"id": "9f66474bf1f5bf9fb4122e55c61b9183ce92a3682d5263026f7a6eb7f67984f5",
"pubkey": "261922e8e17d995254e8aad9b0dcfe609ecc46172ac46d815dc6dc8709956502",
"created_at": 1781887662,
"kind": 1,
"tags": [
[
"proxy",
"https://pony.social/@thephd/116777789862679253",
"web"
],
[
"proxy",
"https://pony.social/users/thephd/statuses/116777789862679253",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://pony.social/users/thephd/statuses/116777789862679253",
"pink.momostr"
],
[
"-"
]
],
"content": "(Shot in the dark) if anyone has worked on GCC, I'm running into an issue I'm having a hard time fixing.\n\nGCC'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\u003ccode\u003econsteval int third () { // Line 1\u003cbr\u003e return __builtin_LINE_at(2); // Line 2\u003cbr\u003e} // Line 3\u003cbr\u003e// Line 4, etc ...\u003cbr\u003econsteval int second () {\u003cbr\u003e return third();\u003cbr\u003e}\u003cbr\u003e\u003cbr\u003econsteval int first () {\u003cbr\u003e return second();\u003cbr\u003e}\u003cbr\u003e\u003cbr\u003estatic_assert(first() == 10);\u003cbr\u003e\u003c/code\u003e\n\nThat 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.\n\nRrrrRrarharahraaaagh.",
"sig": "8d2e7ac84871b16c2f2a09712b7cd8a14c6da49c78572c2926b9803bb420e337cdb0cea9439c479178b71a3a12d0fee422354768d0cc71d4973c2df8bff9498a"
}