projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug #631653
[fw/sdcc]
/
src
/
SDCC.y
diff --git
a/src/SDCC.y
b/src/SDCC.y
index 4a7ac6cfc2e3ac0beb8062c66926002ba08a90db..44ef82b949ea23af59371be1da2b109518ce042d 100644
(file)
--- a/
src/SDCC.y
+++ b/
src/SDCC.y
@@
-1015,6
+1015,7
@@
pointer
default:
// this could be just "constant"
// werror(W_PTR_TYPE_INVALID);
default:
// this could be just "constant"
// werror(W_PTR_TYPE_INVALID);
+ ;
}
}
else
}
}
else
@@
-1101,9
+1102,13
@@
type_name
/* go to the end of the list */
sym_link *p;
pointerTypes($2,$1);
/* go to the end of the list */
sym_link *p;
pointerTypes($2,$1);
- for ( p = $2 ; p->next ; p=p->next);
- p->next = $1 ;
- $$ = $2 ;
+ for ( p = $2 ; p && p->next ; p=p->next);
+ if (!p) {
+ werror(E_SYNTAX_ERROR, yytext);
+ } else {
+ p->next = $1 ;
+ }
+ $$ = $2 ;
}
;
}
;
@@
-1146,6
+1151,12
@@
abstract_declarator2
// $1 must be a pointer to a function
sym_link *p=newLink();
DCL_TYPE(p) = FUNCTION;
// $1 must be a pointer to a function
sym_link *p=newLink();
DCL_TYPE(p) = FUNCTION;
+ if (!$1) {
+ // ((void (code *) ()) 0) ()
+ $1=newLink();
+ DCL_TYPE($1)=CPOINTER;
+ $$ = $1;
+ }
$1->next=p;
}
| abstract_declarator2 '(' parameter_type_list ')' {
$1->next=p;
}
| abstract_declarator2 '(' parameter_type_list ')' {
@@
-1165,6
+1176,7
@@
abstract_declarator2
$1->next=p;
}
}
$1->next=p;
}
}
+ ;
initializer
: assignment_expr { $$ = newiList(INIT_NODE,$1); }
initializer
: assignment_expr { $$ = newiList(INIT_NODE,$1); }
@@
-1306,6
+1318,7
@@
while : WHILE { /* create and push the continue , break & body labels */
sprintf (lbuff,"_whilebody_%d",Lblnum++);
$$ = newSymbol(lbuff,NestLevel);
}
sprintf (lbuff,"_whilebody_%d",Lblnum++);
$$ = newSymbol(lbuff,NestLevel);
}
+ ;
do : DO { /* create and push the continue , break & body Labels */
static int Lblnum = 0 ;
do : DO { /* create and push the continue , break & body Labels */
static int Lblnum = 0 ;
@@
-1320,6
+1333,8
@@
do : DO { /* create and push the continue , break & body Labels */
sprintf (lbuff,"_dobody_%d",Lblnum++);
$$ = newSymbol (lbuff,NestLevel);
}
sprintf (lbuff,"_dobody_%d",Lblnum++);
$$ = newSymbol (lbuff,NestLevel);
}
+ ;
+
for : FOR { /* create & push continue, break & body labels */
static int Lblnum = 0 ;
for : FOR { /* create & push continue, break & body labels */
static int Lblnum = 0 ;
@@
-1336,6
+1351,7
@@
for : FOR { /* create & push continue, break & body labels */
sprintf (lbuff,"_forcond_%d",Lblnum++);
STACK_PUSH(forStack,newSymbol(lbuff,NestLevel));
}
sprintf (lbuff,"_forcond_%d",Lblnum++);
STACK_PUSH(forStack,newSymbol(lbuff,NestLevel));
}
+ ;
iteration_statement
: while '(' expr ')' statement
iteration_statement
: while '(' expr ')' statement