@wingo @barubary OK, here's a do-everything-via-memcpy display of the same gcc bug (again gcc -O1 -m32, after including string.h, stdio.h, math.h): void foo(void *x) { int i; if (isnan(*(float *) x)) memcpy(&i,x,4); printf("%x\n",i); }
void bar(void *x) { int i; memcpy(&i,x,4); printf("%x\n",i); }
int main() { float x = __builtin_nansf(""); foo(&x); bar(&x); return 0; }
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
Daniel J. Bernstein (djb@mastodon.cr.yp.to)'s status on Wednesday, 11-Feb-2026 01:44:33 JST
Daniel J. Bernstein