7 votes 7 votes Write short answers to the following: Which of the following macros can put a macro assembler into an infinite loop? .MACRO M1,X .IF EQ,X M1 X+1 .ENDC .IF NE,X .WORD X .ENDC .ENDM .MACRO M2,X .IF EQ,X M2 X .ENDC .IF NE,X .WORD X+1 .ENDC .ENDM Give an example call that does so. Compiler Design gate1992 compiler-design assembler normal descriptive + – Kathleen asked Sep 13, 2014 edited Oct 27, 2021 by Shaik Masthan Kathleen 2.0k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply rajoramanoj commented Oct 2, 2017 reply Follow Share plz solve this 0 votes 0 votes Shaik Masthan commented Oct 27, 2021 reply Follow Share Macro M1,x EndM that means, M1 is a Macro with x as a parameter, ENDM means Macro end. IF EQ,x ENDC that means, if condition. EQ,x ... checking x is equal to Something or not ? what M1(x) is doing ? checking x is equal to value in the Accumulator, if so, call M1(x+1) what M2(x) is doing ? checking x is equal to value in the Accumulator, if so, call M2(x), So this may lead to Infinite loop when if condtion true. 0 votes 0 votes amitarp818 commented Aug 21, 2023 reply Follow Share Is this in the syllabus still for GATE 2024?? 0 votes 0 votes Please log in or register to add a comment.
Best answer 11 votes 11 votes Macro $M_2$ can put the macro assembler into an infinite loop when called with $M_2(0)$ $(EQ(X)$ is TRUE when $X = 0)$ For $M_1$ the argument $X$ is incremented for the recursive call and so the macro expansion will happen maximum $2$ times. Arjun answered Jun 29, 2019 Arjun comment Share Follow See all 3 Comments See all 3 3 Comments reply shashankrustagi commented Nov 2, 2020 reply Follow Share Source for this??? 0 votes 0 votes svas7246 commented Oct 15, 2021 reply Follow Share Why is (EQ(X) TRUE when X=0) why is it true for x=0 not for x=1 0 votes 0 votes jiminpark commented Nov 14, 2021 reply Follow Share @svas7246, is assembler concept in 2022 syllabus? 0 votes 0 votes Please log in or register to add a comment.