nisse@lysator.liu.se (Niels Möller) writes:
nisse@lysator.liu.se (Niels Möller) writes:
For now, I think I'll fix this, and add a TMP_ALIGN_DECL, TMP_ALIGN_ALLOC.
Below patch seems to work. Other options?
Replying to myself again, I guess one other option is to drop alloca completely in favor of c99 (and gnuc) variable length arrays. alloca isn't exactly equivalent, but I'm fairly confident that all use of alloca within nettle can be easily replaced with variable length arrays. Two slight drawbacks:
1. It's unfortunately demoted to an optional feature in c11 (see https://en.wikipedia.org/wiki/C11_(C_standard_revision)). I would guess this is unlikely to be a real problem.
2. When allocating a context struct where we only know the size, we'd still need some hack to allocate as a uint64_t array or so, to ensure sufficient alignment. Unlike alloca, which will to whatever is needed with the stack pointer to get same minimum alignment as malloc.
Regards, /Niels