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 a.c
int f (void)
{
char a[] = "012\0";
return __builtin_strlen (a + 3); // GCC 8.x folded into 0, but GCC 5.x failed
}
int g (void)
{
char a[] = "012\0";
return __builtin_strlen (a + 4); // not folded
}
GCC 5.5 failed to fold for f and g:
;; Function f (f, funcdef_no=0, decl_uid=1486, cgraph_uid=0, symbol_order=0)
f ()
{
char a[5];
long unsigned int _3;
int _4;
<bb 2>:
a = "012";
_3 = __builtin_strlen (&MEM[(void *)&a + 3B]);
_4 = (int) _3;
a ={v} {CLOBBER};
return _4;
}
;; Function g (g, funcdef_no=1, decl_uid=1490, cgraph_uid=1, symbol_order=1)
g ()
{
char a[5];
long unsigned int _3;
int _4;
<bb 2>:
a = "012";
_3 = __builtin_strlen (&MEM[(void *)&a + 4B]);
_4 = (int) _3;
a ={v} {CLOBBER};
return _4;
}
And GCC 8.x only failed to fold for g:
;; Function f (f, funcdef_no=0, decl_uid=1582, cgraph_uid=0, symbol_order=0)
f ()
{
<bb 2> [local count: 1073741825]:
return 0;
}
;; Function g (g, funcdef_no=1, decl_uid=1586, cgraph_uid=1, symbol_order=1)
g ()
{
char a[5];
long unsigned int _1;
int _4;
<bb 2> [local count: 1073741825]:
a = "012";
_1 = __builtin_strlen (&MEM[(void *)&a + 4B]);
_4 = (int) _1;
a ={v} {CLOBBER};
return _4;
}
Hi fellows,
As PR83190 mentioned:
Testcase:
GCC 5.5 failed to fold for
f
andg
:And GCC 8.x only failed to fold for
g
:But LLVM 7.x works:
Regards,
Leslie Zhai
The text was updated successfully, but these errors were encountered: