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
|
|
builtin.patch
Description: Binary data
test.c
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

