[Issue 10750] New: Strict aliasing semantics

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 3 04:06:43 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10750

           Summary: Strict aliasing semantics
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from David Nadlinger <code at klickverbot.at> 2013-08-03 04:06:41 PDT ---
>From a discussion on dm.D
(http://forum.dlang.org/post/kt026a$256e$1@digitalmars.com):

–––
On Saturday, 27 July 2013 at 08:59:54 UTC, Walter Bright wrote:
> On 7/27/2013 1:57 AM, David Nadlinger wrote:
>> On Saturday, 27 July 2013 at 06:58:04 UTC, Walter Bright wrote:
>>> Although it isn't in the spec, D should be "strict aliasing". 
>>> This is because:
>>>
>>> 1. it enables better code generation
>>>
>>> 2. there are ways, such as unions, to get the other aliasing 
>>> that doesn't
>>> break strict aliasing
>>
>> We need to carefully formalize this then, and quickly. The 
>> problem GCC, Clang
>> and others are facing is that (as you are probably aware) 2. 
>> isn't guaranteed to
>> work for type-casting pointers either by the specs, but people 
>> want to be able
>> to do this nonetheless.
>>
>> Thus, they both accept pointer aliasing through union types, 
>> trying to optimize
>> as much as possible while avoiding to break people's 
>> expectations and existing
>> code. This is a very unfortunate situation for both compiler 
>> developers and
>> users; just search for something like "gcc strict aliasing" on 
>> StackOverflow for
>> examples.
>>
>> There is already quite a lot of D code out there that violates 
>> the C-style
>> strict aliasing rules.
>
> I agree. Want to do an enhancement request on bugzilla for it?
–––

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list