You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat c.c
char a[4];
char b[4];
int f (void)
{
__builtin_strcpy (a, "abc");
__builtin_strcpy (b, "abc");
return __builtin_strcmp (a, b); // not folded but could be
}
int g (const char *s)
{
__builtin_strcpy (a, s);
__builtin_strcpy (b, s);
return __builtin_strcmp (a, b); // not folded but could be
}
GCC 5.5 and 8x. failed to folded:
$ /opt/loongson-gnu-5.5/bin/mips64-linux-gnu-gcc -O2 -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout t.c
;; Function f (f, funcdef_no=0, decl_uid=1486, cgraph_uid=0, symbol_order=0)
f (char * d)
{
void * _4;
long unsigned int _6;
unsigned int _7;
<bb 2>:
__builtin_memcpy (d_2(D), "abc", 3);
_4 = d_2(D) + 3;
__builtin_memcpy (_4, "def", 4);
_6 = __builtin_strlen (d_2(D));
_7 = (unsigned int) _6;
return _7;
}
;; Function g (g, funcdef_no=1, decl_uid=1489, cgraph_uid=1, symbol_order=1)
g (char * d)
{
void * _4;
long unsigned int _6;
unsigned int _7;
<bb 2>:
_4 = __builtin_mempcpy (d_2(D), "abc", 3);
__builtin_mempcpy (_4, "def", 4);
_6 = __builtin_strlen (d_2(D));
_7 = (unsigned int) _6;
return _7;
}
Regards,
Leslie Zhai
The text was updated successfully, but these errors were encountered:
Hi fellows,
As PR82950 mentioned:
Testcase:
GCC 5.5 and 8x. failed to folded:
Regards,
Leslie Zhai
The text was updated successfully, but these errors were encountered: