We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4095 - fix strict aliasing warnings in SDL_test_fuzzer.c
Summary: fix strict aliasing warnings in SDL_test_fuzzer.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-25 07:20 UTC by Ozkan Sezer
Modified: 2018-02-25 17:46 UTC (History)
0 users

See Also:


Attachments
SDL_test_fuzzer.c strict aliasing patch (1.26 KB, patch)
2018-02-25 07:20 UTC, Ozkan Sezer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2018-02-25 07:20:05 UTC
Created attachment 3181 [details]
SDL_test_fuzzer.c strict aliasing patch

I always get the following warnings from SDL_test_fuzzer.c:

src/test/SDL_test_fuzzer.c: In function 'SDLTest_RandomUint64':
src/test/SDL_test_fuzzer.c:130: warning: likely type-punning may break strict-aliasing rules: object '*vp' of main type 'unsigned int' is referenced at or around src/test/SDL_test_fuzzer.c:134 and may be aliased to object 'value' of main type 'long long unsigned int' which is referenced at or around src/test/SDL_test_fuzzer.c:129.
src/test/SDL_test_fuzzer.c:135: warning: likely type-punning may break strict-aliasing rules: object '*{unknown}' of main type 'unsigned int' is referenced at or around src/test/SDL_test_fuzzer.c:135 and may be aliased to object 'value' of main type 'long long unsigned int' which is referenced at or around src/test/SDL_test_fuzzer.c:129.

The attached patch fixes it by using a union instead of type-punning.
Comment 1 Sam Lantinga 2018-02-25 17:46:00 UTC
Added, thanks!
https://hg.libsdl.org/SDL/rev/732b6ef4aae7