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 4079

Summary: lots of strict aliasing warnings
Product: SDL Reporter: Ozkan Sezer <sezeroz>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: mednafen
Version: HG 2.0   
Hardware: All   
OS: Linux   
Attachments: warnings log from gcc-4.5.4
patch to revert typecast assingment changes
patch to revert typecast assignment changes
patch to revert typecast assignment changes

Description Ozkan Sezer 2018-02-12 07:00:45 UTC
Created attachment 3163 [details]
warnings log from gcc-4.5.4

FYI: A _horde_ of strict aliasing warnings are emitted from older gcc,
such as gcc-4.3 or -4.5, after the recent typecast assignment changes.
Log from gcc-4.5 is attached.
Comment 1 Sam Lantinga 2018-02-12 07:32:59 UTC
*sigh*

These were changed to fix ISO C99 pedantic warnings in GCC 5.

Is there a way to cast from void* to function pointer that works with both compilers in strict mode?
Comment 2 Ozkan Sezer 2018-02-12 07:57:18 UTC
Not that I know of. (apart from 'don't use -pedantic', of course..)
Comment 3 Ozkan Sezer 2018-02-12 14:01:07 UTC
Created attachment 3165 [details]
patch to revert typecast assingment changes

I am using the attached patch to revert typecast assignment changes
for the time being.
Comment 4 mednafen 2018-02-12 18:26:48 UTC
Perhaps memcpy()
Comment 5 Ozkan Sezer 2018-02-12 18:29:55 UTC
Created attachment 3166 [details]
patch to revert typecast assignment changes

(Attaching the correct version of the patch tis time.)
Comment 6 Ozkan Sezer 2018-02-12 22:10:53 UTC
Created attachment 3167 [details]
patch to revert typecast assignment changes

3rd revision of the patch to revert typecast assignment changes:
Also changes the void* typedefs for the two vulkan function pointers
added in vulkan_internal.h into generic C function pointer typedefs.
Comment 7 Sam Lantinga 2018-02-13 21:28:52 UTC
Okay, pedantic warnings are better than strict aliasing warnings.
https://hg.libsdl.org/SDL/rev/e917e911dab6

Thanks!