repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git]
/
gcc
/
testsuite
/
gcc.dg
/
strlenopt-27.c
blob
c539edb821ccc7cc0e14c8a850c743e0aef30641
1
/* { dg-do run } */
2
/* { dg-options "-O2 -fdump-tree-strlen" } */
3
4
#include
"strlenopt.h"
5
6
__attribute__
((
noinline
,
noclone
))
size_t
7
fn1
(
char
*
p
)
8
{
9
strcpy
(
p
,
"foobar"
);
10
return
strlen
(
p
+
2
);
// This strlen should be optimized into 4.
11
}
12
13
int
14
main
(
void
)
15
{
16
char
p
[] =
"barfoo"
;
17
if
(
fn1
(
p
) !=
4
)
18
abort
();
19
return
0
;
20
}
21
22
/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */