<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>P {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
TD {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
LI {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
BODY {
        LINE-HEIGHT: 1.4; MARGIN: 10px; FONT-FAMILY: Arial, arial; FONT-SIZE: 9pt
}
</STYLE>

<META name=GENERATOR content=ActiveSquare></HEAD>
<BODY>
<P>The TC was compiled using clang -- clang version 3.5.0 (204114)<BR>Target: x86_64-unknown-linux-gnu<BR> compilation options: -O2</P>
<P> </P>
<P>------- <B>Original Message</B> -------</P>
<P><B>Sender</B> : MAYUR PANDEY<mayur.p@samsung.com> Lead Engineer/SRI-Bangalore-Native Framework/Samsung Electronics</P>
<P><B>Date</B> : Mar 18, 2014 17:19 (GMT+09:00)</P>
<P><B>Title</B> : [PATCH] Wrong output from built-in size function</P>
<P> </P>
<META name=GENERATOR content=ActiveSquare><X-BODY>
<P>Hi,</P>
<P>Please find attached the fix for wrong output from built-in size function. The Testcase attached is a standard gcc testsuite TC. </P>
<P> </P>
<P>extern void abort (void);</P>
<P>extern inline __attribute__ ((__always_inline__)) int<BR>foo (char *dest)<BR>{<BR>  return __builtin_object_size (dest, 1);<BR>}</P>
<P>struct S<BR>{<BR>  union<BR>  {<BR>    struct { int a, b; char c, d; } f;<BR>    struct { struct { int a, b; char c, d[255]; } e; } g;<BR>  } u;<BR>};</P>
<P>int<BR>main (void)<BR>{<BR>  struct S s;<BR>  if (foo (s.u.g.e.d) != 255)<BR>    abort ();<BR>  return 0;<BR>}</P>
<P> </P>
<P>In the TC above the abort function is called as clang is unable to return correct output on calling built-in size function. the reason seems to be that in Instruction Combination pass for optimization,</P>
<P>Clang was not able to properly handle built-in size function as per new DFS implementation. So Moving it back to follow iterative way specifically for built-in size function.</P>
<P> </P>
<P>Please Review.</P>
<P> </P>
<P>Thanks,</P>
<P>Mayur</P>
<P> </P><!--SP:mayur.p--><!--mayur.p:EP-->
<P> </P></X-BODY><IMG style="DISPLAY: none" border=0 src="http://ext.samsung.net/mailcheck/SeenTimeChecker?do=6ec7a20cfdabd4efdaf4c8f65061077062cf9e4a0106df1ee9a2b094e88a4f1f81a5d6148418374b434c6ebf74e200ff220d3e02ce1cb961d6250c6ef56fc7aacf878f9a26ce15a0" width=0 height=0> 
<P> </P>
<P> </P><!--SP:mayur.p--><!--mayur.p:EP-->
<P> </P>
<TABLE id=confidentialsignimg>
<TBODY>
<TR>
<TD NAMO_LOCK>
<P><IMG border=0 src="cid:BEI0XT4NZ5JE@namo.co.kr" width=520></P></TD></TR></TBODY></TABLE></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=6ec7a20cfdabd4ef513665771e44a6599a91c983575a4ec8e9a2b094e88a4f1f81a5d6148418374b434c6ebf74e200ff220d3e02ce1cb961d6250c6ef56fc7aacf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>