www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10791] New: Strange asm behavior in if's

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791

           Summary: Strange asm behavior in if's
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: temtaime gmail.com


--- Comment #0 from Temtaime <temtaime gmail.com> 2013-08-11 02:20:32 PDT ---
if(1)
        asm {};
    else
        asm {};

Error: found 'else' instead of statement
Error: unrecognized declaration

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 11 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791


Kenji Hara <k.hara.pg gmail.com> changed:

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


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-08-13 05:16:44 PDT ---
http://dlang.org/statement.html

Statement:
  NonEmptyStatement

NonEmptyStatement:
  NonEmptyStatementNoCaseNoDefault

NonEmptyStatementNoCaseNoDefault:
  AsmStatement

AsmStatement:
  asm { }
  asm { AsmInstructionList }

AsmStatement does not take semicolon at the end, then

if(1)
        asm {};
    else
        asm {};

is mostly same as:

if (1) { asm {} }
;
else { asm {} }
;

and the 'else' part is stray.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791



--- Comment #2 from Temtaime <temtaime gmail.com> 2013-08-13 10:51:48 PDT ---
Why asm statement doesn't follow common rules?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10791


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru


--- Comment #3 from Maxim Fomin <maxim maxim-fomin.ru> 2013-08-13 11:05:42 PDT
---
(In reply to comment #2)
 Why asm statement doesn't follow common rules?
One reason is because although AsmStatement is formally a statement, it is actually close to a BlockStatement (AsmInstruction is close to regular statement) and BlockStatements don't have ";" after them (like aggregate type declarations and enum declarations). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 13 2013