<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Compiler Crashed on Specific Macro</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/18021/compiler-crashed-on-specific-macro</link><description> Hi all, 
I defined a macro as 
 #define min(a,b) (((a) &amp;lt; (b)) ? (a) : (b)) 
and used it as 
 xfr_cnt = min(to_xfer, secsize - boff); 
but every time compiler crashed on this C file. It is ok after I expanded it as 
 xfr_cnt= ((to_xfer &amp;lt; (secsize - boff</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Compiler Crashed on Specific Macro</title><link>https://community.arm.com/thread/42750?ContentTypeID=1</link><pubDate>Fri, 10 Sep 2004 01:12:17 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a5aa5fc4-2557-4108-8f02-a032c0229ec1</guid><dc:creator>Oleg Sergeev</dc:creator><description>&lt;p&gt;hi,&lt;br /&gt;
&lt;br /&gt;
try to avoid any spaces when pass arguments to macro which uses formal parameters. Another way - use additional brackets for complex arguments.&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Oleg&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler Crashed on Specific Macro</title><link>https://community.arm.com/thread/42751?ContentTypeID=1</link><pubDate>Thu, 09 Sep 2004 08:36:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b68cd177-3aeb-4dc8-8944-09cebf4b8ec1</guid><dc:creator>Matthias Hertel</dc:creator><description>&lt;p&gt;I tried the code snippets, that you have posted with the C51 V7.20. The macro is expanded like yours and the object file is generated correctly. There must be anything special that you do in your code.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
#define min(a,b)       (((a) &amp;lt; (b)) ? (a) : (b))

void test (void) {
  int xfr_cnt;
  int to_xfer = 1;
  int secsize = 4;
  int boff    = 2;
  xfr_cnt = min(to_xfer, secsize-boff);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler Crashed on Specific Macro</title><link>https://community.arm.com/thread/111052?ContentTypeID=1</link><pubDate>Thu, 09 Sep 2004 07:57:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:42c39ffd-1e6e-4333-9915-c7c5528949b0</guid><dc:creator>John Donaldson</dc:creator><description>&lt;p&gt;Best send a report to Keil in that case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler Crashed on Specific Macro</title><link>https://community.arm.com/thread/96566?ContentTypeID=1</link><pubDate>Thu, 09 Sep 2004 07:12:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:82050074-3dd1-4a7b-bbe5-8389763bc0ad</guid><dc:creator>Bryan Wang</dc:creator><description>&lt;p&gt;No, it&amp;#39;s a Windows XP error dialog box.&lt;br /&gt;
I can continue, but seems the C file is not&lt;br /&gt;
compiled anyway.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler Crashed on Specific Macro</title><link>https://community.arm.com/thread/86918?ContentTypeID=1</link><pubDate>Thu, 09 Sep 2004 06:14:42 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b453a0f7-1985-4c4a-a62a-9b7b05d4d28a</guid><dc:creator>John Donaldson</dc:creator><description>&lt;p&gt;Did it give an error message?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Compiler Crashed on Specific Macro</title><link>https://community.arm.com/thread/42749?ContentTypeID=1</link><pubDate>Thu, 09 Sep 2004 05:46:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:247522f8-601f-456e-a4a6-3473fe0088b8</guid><dc:creator>Bryan Wang</dc:creator><description>&lt;p&gt;It&amp;#39;s okay if I write that as&lt;br /&gt;
&lt;pre&gt;xfr_cnt = min(to_xfer, (secsize - boff));&lt;/pre&gt;
Is that prasing error or something?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>