xref: /third_party/ltp/tools/sparse/sparse-src/validation/eval/premature-examination.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/ltp/tools/sparse/sparse-src/validation/eval/
1f08c3bdfSopenharmony_ciextern int i;
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_ciint foo(void)
4f08c3bdfSopenharmony_ci{
5f08c3bdfSopenharmony_ci	return *i;
6f08c3bdfSopenharmony_ci}
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_ciint bar(void)
9f08c3bdfSopenharmony_ci{
10f08c3bdfSopenharmony_ci	return i[0];
11f08c3bdfSopenharmony_ci}
12f08c3bdfSopenharmony_ci
13f08c3bdfSopenharmony_ciint *qux(void)
14f08c3bdfSopenharmony_ci{
15f08c3bdfSopenharmony_ci	return &i[0];
16f08c3bdfSopenharmony_ci}
17f08c3bdfSopenharmony_ci
18f08c3bdfSopenharmony_ci/*
19f08c3bdfSopenharmony_ci * check-name: premature-examination
20f08c3bdfSopenharmony_ci * check-command: sparse -Wno-decl $file
21f08c3bdfSopenharmony_ci *
22f08c3bdfSopenharmony_ci * check-error-start
23f08c3bdfSopenharmony_cieval/premature-examination.c:5:16: error: cannot dereference this type
24f08c3bdfSopenharmony_cieval/premature-examination.c:10:17: error: cannot dereference this type
25f08c3bdfSopenharmony_cieval/premature-examination.c:15:18: error: cannot dereference this type
26f08c3bdfSopenharmony_ci * check-error-end
27f08c3bdfSopenharmony_ci */
28

Indexes created Thu Nov 07 10:32:03 CST 2024