Title: Samsung Enterprise Portal mySingle

The TC was compiled using clang -- clang version 3.5.0 (204114)
Target: x86_64-unknown-linux-gnu
 compilation options: -O2

 

------- Original Message -------

Sender : MAYUR PANDEY<[email protected]> Lead Engineer/SRI-Bangalore-Native Framework/Samsung Electronics

Date : Mar 18, 2014 17:19 (GMT+09:00)

Title : [PATCH] Wrong output from built-in size function

 

Hi,

Please find attached the fix for wrong output from built-in size function. The Testcase attached is a standard gcc testsuite TC.

 

extern void abort (void);

extern inline __attribute__ ((__always_inline__)) int
foo (char *dest)
{
  return __builtin_object_size (dest, 1);
}

struct S
{
  union
  {
    struct { int a, b; char c, d; } f;
    struct { struct { int a, b; char c, d[255]; } e; } g;
  } u;
};

int
main (void)
{
  struct S s;
  if (foo (s.u.g.e.d) != 255)
    abort ();
  return 0;
}

 

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,

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.

 

Please Review.

 

Thanks,

Mayur

 

 

 

 

 

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to