Overview
| Artifact ID: | 60e67bcf7be02461cfd1de1547249a34a6caa3654dcc6f3c4c491cf3eb871300 |
|---|---|
| Ticket: | 3d3124d01dabb46584e39877d44802bf5e8f4952
failures with -ftrapv compiler option |
| User & Date: | chrstphrchvz on 2023-08-15 07:26:51 |
Changes
- icomment:
I am not certain which operation overflowed here. <tt>c - '0'</tt> only overflows when <tt>c < -0x50</tt>. If <tt>isdigit(UCHAR(c))</tt> is true, then <tt>c</tt> is between <tt>0x30</tt> and <tt>0x39</tt>, so <tt>c - '0'</tt> cannot overflow. Something else seems wrong. I do not know if declaring <tt>c</tt> as <tt>unsigned char</tt> (since <tt>char</tt> is signed by default on Darwin amd64) to avoid the <tt>-ftrapv</tt> exception is a good idea or just hides the problem. But I have not spotted any relevant changes since this issue was reported which may have resolved it. So far I cannot reproduce this issue with either <tt>-ftrapv</tt> or <tt>-fsanitize=signed-integer-overflow</tt> when I run these examples.
- login: "chrstphrchvz"
- mimetype: "text/x-fossil-wiki"