January 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #20 from Iain Buclaw <ibuclaw@ubuntu.com> 2012-01-31 06:24:46 PST ---
I can't seem to get git working at work. :)



(In reply to comment #16)
> 
> Yes, I agree.  My proposal was the following.
> 
> // excerpt from parse.c line 503.
> case TOKalign:
> {   unsigned n;
> 
>   s = NULL;
>   nextToken();
>   if (token.value == TOKlparen)
>   {
>     nextToken();
>     if (token.value == TOKint32v && token.uns64value > 0)
>       n = (unsigned)token.uns64value;
>     else
>     {   error("positive integer expected, not %s", token.toChars());
>         n = 1;
>     }
>     nextToken();
>     check(TOKrparen);
>   }
>   else
> -    n = global.structalign; // default
> +    n = 0; // default
> 
>   a = parseBlock();
>   s = new AlignDeclaration(n, a);
>   break;
> }
> 
> Now the compiler can test for 0 and know that default alignment is required. This removes the ambiguity with the current implementation.

Daniel, to add to that:

  if (token.value == TOKlparen)
  {
    nextToken();
    if (token.value == TOKint32v && token.uns64value > 0)
+   {
+     if (token.value & (token.value - 1))
+         error("align must be a power of 2, not %s", token.toChars());
      n = (unsigned)token.uns64value;
+   }
    else
    {   error("positive integer expected, not %s", token.toChars());
        n = 1;
    }
    nextToken();
    check(TOKrparen);
  }



And in attrib.h:
 struct AlignDeclaration : AttribDeclaration
 {
-    unsigned salign;
+    unsigned salign;          // alignment in effect, must be power of 2.
+                              // 0 if using default align for target.

     AlignDeclaration(unsigned sa, Dsymbols *decl);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #21 from dawg@dawgfoto.de 2012-02-01 11:42:18 PST ---
>I think it would also make sense to disallow any align(n) value greater than
>align(16) for 32bit, and possibly align(32) for 64bit platforms.

Don't do that. GCC can provide arbitrary alignment even for stack values. Also your number is already too low, xsave needs 64-byte alignment.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #22 from github-bugzilla@puremagic.com 2012-06-28 21:42:32 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/4a5a8352e91dd361a96644fb3aaa1aece0c9d0d8 fix Issue 7396 - Indicate default alignment with 0.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #23 from Walter Bright <bugzilla@digitalmars.com> 2012-06-28 21:43:46 PDT ---
Addressed using a #define rather than a magic value, and a typedef.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #24 from github-bugzilla@puremagic.com 2012-06-28 22:57:55 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/81fc676f9ae108fd673a77019d29b4aaa91aa8e6 fix Issue 7396 - Indicate default alignment with 0.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #25 from Iain Buclaw <ibuclaw@ubuntu.com> 2012-06-29 09:22:59 PDT ---
Thanks, I'll be merging this in tonight.  Does the frontend error if the alignment given is not a power of 2?


ie: using align(3) should not ICE or compile.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7396



--- Comment #26 from Walter Bright <bugzilla@digitalmars.com> 2012-06-29 15:18:16 PDT ---
Currently, it does not. I regard that as a separate issue, however.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2 3
Next ›   Last »