File: type1.c

package info (click to toggle)
sparse 0.6.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,868 kB
  • sloc: ansic: 46,050; sh: 614; python: 301; perl: 293; makefile: 279
file content (27 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Sparse used to get this wrong.
 *
 * When evaluating the argument to the inline function for the array, Sparse
 * didn't properly demote the "char []" to a "char *", but instead it would
 * follow the dereference and get a "struct hello".
 *
 * Which made no sense at all.
 */

static inline int deref(const char *s)
{
	return *s;
}

struct hello {
	char array[10];
};

static int test(struct hello *arg)
{
	return deref(arg->array);
}

/*
 * check-name: "char []" to "char *" demotion
 */