Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
51948daf
Commit
51948daf
authored
Dec 06, 2018
by
Jeff Law
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop duplicate half of doubly-applied test.
From-SVN: r266854
parent
44d6626c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
64 deletions
+0
-64
gcc/testsuite/gcc.dg/Wstringop-truncation-5.c
+0
-64
No files found.
gcc/testsuite/gcc.dg/Wstringop-truncation-5.c
View file @
51948daf
...
...
@@ -62,67 +62,3 @@ void test_compound_literal (struct S *s)
strncpy
(
s
->
a
,
(
char
[]){
STR
},
sizeof
s
->
a
-
1
);
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
/* PR tree-optimization/87028 - false positive -Wstringop-truncation
strncpy with global variable source string
{ dg-do compile }
{ dg-options "-O2 -Wstringop-truncation" } */
char
*
strncpy
(
char
*
,
const
char
*
,
__SIZE_TYPE__
);
#define STR "1234567890"
struct
S
{
char
a
[
5
],
b
[
5
];
};
const
char
arr
[]
=
STR
;
const
char
*
const
ptr
=
STR
;
const
char
arr2
[][
10
]
=
{
"123"
,
STR
};
void
test_literal
(
struct
S
*
s
)
{
strncpy
(
s
->
a
,
STR
,
sizeof
s
->
a
-
1
);
/* { dg-bogus "\\\[-Wstringop-truncation]" } */
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
void
test_global_arr
(
struct
S
*
s
)
{
strncpy
(
s
->
a
,
arr
,
sizeof
s
->
a
-
1
);
/* { dg-bogus "\\\[-Wstringop-truncation]" } */
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
void
test_global_arr2
(
struct
S
*
s
)
{
strncpy
(
s
->
a
,
arr2
[
1
],
sizeof
s
->
a
-
1
);
/* { dg-bogus "\\\[-Wstringop-truncation]" } */
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
strncpy
(
s
->
b
,
arr2
[
0
],
sizeof
s
->
a
-
1
);
}
void
test_global_ptr
(
struct
S
*
s
)
{
strncpy
(
s
->
a
,
ptr
,
sizeof
s
->
a
-
1
);
/* { dg-bogus "\\\[-Wstringop-truncation]" } */
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
void
test_local_arr
(
struct
S
*
s
)
{
const
char
arr
[]
=
STR
;
strncpy
(
s
->
a
,
arr
,
sizeof
s
->
a
-
1
);
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
void
test_local_ptr
(
struct
S
*
s
)
{
const
char
*
const
ptr
=
STR
;
strncpy
(
s
->
a
,
ptr
,
sizeof
s
->
a
-
1
);
/* { dg-bogus "\\\[-Wstringop-truncation]" } */
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
void
test_compound_literal
(
struct
S
*
s
)
{
strncpy
(
s
->
a
,
(
char
[]){
STR
},
sizeof
s
->
a
-
1
);
s
->
a
[
sizeof
s
->
a
-
1
]
=
'\0'
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment