scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

test016.c (905B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /*
      4 name: TEST016
      5 description: Basic pointer test
      6 error:
      7 test016.c:42: error: redefinition of 'func2'
      8 test016.c:46: error: incompatible types when assigning
      9 output:
     10 G1	I	"g
     11 G3	I	F	"func1
     12 {
     13 \
     14 A4	I	"x
     15 A6	P	"p
     16 	G1	#I1	:I
     17 	A4	#I1	:I
     18 	A6	A4	'P	:P
     19 	A6	@I	#I0	:I
     20 	y	L7	A4	#I0	=I
     21 	h	#I1
     22 L7
     23 	A6	G1	'P	:P
     24 	A6	@I	#I0	:I
     25 	y	L8	A6	#P0	!I
     26 	h	#I1
     27 L8
     28 	h	#I0
     29 }
     30 G9	I	F	"func2
     31 {
     32 \
     33 A10	I	"x
     34 A11	P	"p
     35 A13	P	"pp
     36 	A10	#I1	:I
     37 	A11	A10	'P	:P
     38 	A13	A11	'P	:P
     39 	y	L14	A11	#P0	=I
     40 	A13	@P	@I	#I0	:I
     41 L14
     42 	A11	#P0	:P
     43 	h	A10
     44 }
     45 */
     46 
     47 #line 1
     48 
     49 int g;
     50 
     51 int
     52 func1(void)
     53 {
     54 	int  x;
     55 	int *p;
     56 
     57 	g = 1;
     58 	x = 1;
     59 	p = &x;
     60 	*p = 0;
     61 	if (x)
     62 		return 1;
     63 
     64 	p = &g;
     65 	*p = 0;
     66 	if (p == 0)
     67 		return 1;
     68 	return 0;
     69 }
     70 
     71 int
     72 func2(void)
     73 {
     74 	int   x;
     75 	int  *p;
     76 	int **pp;
     77 
     78 	x = 1;
     79 	p = &x;
     80 	pp = &p;
     81 	if (p != 0)
     82 		**pp = 0;
     83 	p = 0;
     84 	return x;
     85 }
     86 
     87 int
     88 func2(void)
     89 {
     90 	char c;
     91 	int *p;
     92 
     93 	p = &c;
     94 	return *p;
     95 }