On Tue, 27 Oct 2026, LIU Hao wrote:
在 2026-10-27 17:45, Martin Storsjö 写道:
On Wed, 23 Sep 2026, LIU Hao wrote:
This should be ok, thanks.
I didn't proofread that the semantics around __builtin_add_overflow are
correct, but if this passes our CI it should be fine.
Although one potential concern (which might not be a blocker) is for how
long __builtin_add_overflow has existed in GCC - some of our users like to
keep building with very old GCC/binutils. If that is a problem I guess it
should be possible to manually check things like "if (size >= __SIZE_MAX__
- (offsets))", but that's more error prone...
The proof is as follows:
1. Right before this hunk, `alignment` is always set to a power of two, which
is non-zero.
2. `GAP (offset)` is a modulo of `sizeof (void *)`, so it's <= 7.
3. Therefore `alignment + GAP (offset) + sizeof (void *)` can't overflow for
any inputs.
4. Only `size` is a user-supplied parameter.
That's good - but that wasn't what I meant.
What I meant was that I didn't check up the semantics of this function,
how it actually returns errors etc. I didn't look that up and check that
it matches your patch - so I'm assuming that you have tested it yourself,
triggering both a succeeding and a failing case.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public