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

Submitter:  None
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup

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


There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.


No changes have been made to this item

Back to the top

Powered by Savane 3.12.
Corresponding source code