bugTiny C Compiler - Bugs: bug #53961, #if-block bodies, when expanded as...


bug #53961: #if-block bodies, when expanded as macro arguments incorrect if #if argument has a macro in it

Submitted by:  None
Submitted on:  Wed 23 May 2018 10:15:35 AM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 23 May 2018 10:15:35 AM UTC, original submission:  


#define PASTE_X(X) X

#if HAS_X   //same for e.g.: 1*HAS_X+0+2
int x; //this gets replaced by the value of HAS_X

(Compile with e.g., tcc -DHAS_X=42 c.c. The output is then 42 instead of int x; )

This bug only affects expanded #if-blocks -- if the block isn't passed to a macro (variadic or not)
it expands OK.

If the macro inside the argument to the #if is preceded by `defined` or enclosed in `defined()`,
the expansion works OK again.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


CC list is empty


Do you think this task is very important?
If so, you can add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.




No changes have been made to this item

Back to the top

Powered by Savane 3.5