projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug#600035
[fw/sdcc]
/
src
/
SDCCval.c
diff --git
a/src/SDCCval.c
b/src/SDCCval.c
index 59cb58726ea60b3de136a709c625dc62848d7fef..d893ccba608a3a902fbe64b934858e0cd78eb62e 100644
(file)
--- a/
src/SDCCval.c
+++ b/
src/SDCCval.c
@@
-907,6
+907,10
@@
floatFromVal (value * val)
return (double) SPEC_CVAL (val->etype).v_ulong;
}
return (double) SPEC_CVAL (val->etype).v_ulong;
}
+ if (SPEC_NOUN (val->etype) == V_VOID) {
+ return (double) SPEC_CVAL (val->etype).v_ulong;
+ }
+
// we are lost !
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"floatFromVal: unknown value");
// we are lost !
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"floatFromVal: unknown value");
@@
-942,6
+946,12
@@
valUnaryPM (value * val)
}
// -(unsigned 3) now really is signed
SPEC_USIGN(val->etype)=0;
}
// -(unsigned 3) now really is signed
SPEC_USIGN(val->etype)=0;
+ // -(unsigned char)135 now really is an int
+ if (SPEC_NOUN(val->etype) == V_CHAR) {
+ if (SPEC_CVAL(val->etype).v_int < -128) {
+ SPEC_NOUN(val->etype) = V_INT;
+ }
+ }
return val;
}
return val;
}
@@
-966,6
+976,8
@@
valComplement (value * val)
else
SPEC_CVAL (val->etype).v_int = ~SPEC_CVAL (val->etype).v_int;
}
else
SPEC_CVAL (val->etype).v_int = ~SPEC_CVAL (val->etype).v_int;
}
+ // ~(unsigned 3) now really is signed
+ SPEC_USIGN(val->etype)=0;
return val;
}
return val;
}
@@
-1445,7
+1457,6
@@
valCastLiteral (sym_link * dtype, double fval)
int
getNelements (sym_link * type, initList * ilist)
{
int
getNelements (sym_link * type, initList * ilist)
{
- sym_link *etype = getSpec (type);
int i;
if (!ilist)
int i;
if (!ilist)
@@
-1456,13
+1467,13
@@
getNelements (sym_link * type, initList * ilist)
/* if type is a character array and there is only one
(string) initialiser then get the length of the string */
/* if type is a character array and there is only one
(string) initialiser then get the length of the string */
- if (IS_ARRAY (type) && IS_CHAR (
etype
) && !ilist->next)
+ if (IS_ARRAY (type) && IS_CHAR (
type->next
) && !ilist->next)
{
ast *iast = ilist->init.node;
value *v = (iast->type == EX_VALUE ? iast->opval.val : NULL);
if (!v)
{
{
ast *iast = ilist->init.node;
value *v = (iast->type == EX_VALUE ? iast->opval.val : NULL);
if (!v)
{
- werror (
W_INIT_WRONG
);
+ werror (
E_CONST_EXPECTED
);
return 0;
}
return 0;
}
@@
-1479,7
+1490,6
@@
getNelements (sym_link * type, initList * ilist)
i++;
ilist = ilist->next;
}
i++;
ilist = ilist->next;
}
-
return i;
}
return i;
}