lwIP - A Lightweight TCP/IP stack - Bugs: bug #49827, wrong cast to size_t on 16-bit x86...
You are not allowed to post comments on this tracker with your current authentication level.
bug #49827: wrong cast to size_t on 16-bit x86 architecture
Submitter: | Alexander <pronkin> | ||
Submitted: | Mon 12 Dec 2016 08:10:55 AM UTC | ||
Category: | Platform ports | Severity: | 3 - Normal |
Item Group: | Faulty Behaviour | Status: | Fixed |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Closed | Planned Release: | 2.0.1 |
lwIP version: | 2.0.0 |
Jump to the original submission
Tue 13 Dec 2016 08:22:10 PM UTC, comment #18: |
Ambroz Bizjak <abizjak> |
Tue 13 Dec 2016 07:40:26 PM UTC, comment #17: Simon/Dirk,
|
Joel Cunningham <jcunningham> |
Tue 13 Dec 2016 10:43:52 AM UTC, comment #16:
|
Simon Goldschmidt <goldsimon> |
Tue 13 Dec 2016 09:06:38 AM UTC, comment #15: I have test another 16Bit compable compiler (DigitalMars):
|
Alexander <pronkin> |
Tue 13 Dec 2016 07:43:45 AM UTC, comment #14: Re Ambroz:
|
Simon Goldschmidt <goldsimon> |
Tue 13 Dec 2016 06:02:25 AM UTC, comment #13: You correctly described the problems that could happen when you "cast away constness": you may accidentally modify data in read-only memory.
|
Dirk Ziegelmeier <dziegel> |
Tue 13 Dec 2016 01:44:50 AM UTC, comment #12: Just my two cents here, but most of the C code I work with (aside from LwIP) casts away const on function parameters via an explicit cast, const void to void . Most of the code isn't trying to modify the memory, but is simply hooking up two interfaces where one doesn't use const.
|
Joel Cunningham <jcunningham> |
Mon 12 Dec 2016 09:35:33 PM UTC, comment #11: Simon,
|
Ambroz Bizjak <abizjak> |
Mon 12 Dec 2016 09:20:36 PM UTC, comment #10: Reading standards is diffcult ;-)
|
Simon Goldschmidt <goldsimon> |
Mon 12 Dec 2016 09:14:09 PM UTC, comment #9: Hi,
|
Ambroz Bizjak <abizjak> |
Mon 12 Dec 2016 07:43:30 PM UTC, comment #8:
|
Simon Goldschmidt <goldsimon> |
Mon 12 Dec 2016 07:16:37 PM UTC, comment #7: I use OpenWatcom compiler and have next line in headers:
|
Alexander <pronkin> |
Mon 12 Dec 2016 01:09:18 PM UTC, comment #6: Out of curiosity, can you tell us why ptrdiff_t does not work? What type is ptrdiff_t on your system? |
Dirk Ziegelmeier <dziegel> |
Mon 12 Dec 2016 12:50:39 PM UTC, comment #5: I've tested fixes.
|
Alexander <pronkin> |
Mon 12 Dec 2016 09:18:05 AM UTC, comment #4: Fixed, thanks for reporting |
Dirk Ziegelmeier <dziegel> |
Mon 12 Dec 2016 09:17:31 AM UTC, comment #3: Ok, thanks.
|
Alexander <pronkin> |
Mon 12 Dec 2016 08:51:22 AM UTC, comment #2: from 'const void *' to 'void*'... |
Simon Goldschmidt <goldsimon> |
Mon 12 Dec 2016 08:50:22 AM UTC, comment #1: This cast is not unnecessary: we need to get from 'void*' to 'const void*'. Your compiler seems to ignore that fact...
|
Simon Goldschmidt <goldsimon> |
Mon 12 Dec 2016 08:10:55 AM UTC, original submission:
I work on DOS-like 16-bit OS and recently updated lwip from 1.4.1 to 2.0.0. and found that in timouts.c:182 (http://git.savannah.gnu.org/cgit/lwip.git/tree/src/core/timeouts.c#n182)
|
Alexander <pronkin> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2016-12-12 | dziegel | Status | Confirmed | Fixed | |
Open/Closed | Open | Closed | |||
2016-12-12 | goldsimon | Planned Release | None | 2.0.1 | |
2016-12-12 | goldsimon | Status | None | Confirmed |
Powered by Savane 3.13-02a9.
Corresponding source code
Simon,
I have nothing about making things compile with strange compilers or warnings enabled. But I think it is far more appropriate to by default define LWIP_CONST_CAST and friends using simple casts (a correct and safe default), and leave it up to the user to override these macros if that results in warnings.
Speaking of warnings, why would a hypothetical compiler on full warning levels complain about casting away const but not about converting pointers to integers?