On Wed, 20 Apr 2022, o...@eigenstate.org wrote:
When you have a patch, let me know -- I'll happily test
and apply to 9front.
Hi ori, this patch applyes to the sources served at 9front.org.
By the way, do you plan to keep in sync
http://only9fans.com/ori/git9/HEAD/info.html or should I forget
about that repo?
Regards,
adr.
--- /n/9front/sys/src/cmd/cc/lex.c Wed Apr 6 14:45:26 2022
+++ /tmp/lex.c Thu Apr 21 08:39:14 2022
@@ -848,16 +848,9 @@
yyerror("overflow in constant");
vv = yylval.vval;
- /*
-* c99 is silly: decimal constants stay signed,
-* hex and octal go unsigned before widening.
-*/
- w = 32;
- if((c1 & (Numdec|Numuns)) == Numdec)
- w = 31;
- if(c1 & Numvlong || (c1 & Numlong) == 0 && (uvlong)vv >= 1ULL< convvtox(vv, TULONG) ||
+ (c1 & (Numdec|Numuns)) == Numdec && convvtox(vv, TLONG) < 0) {
if((c1 & Numuns) || convvtox(vv, TVLONG) < 0) {
c = LUVLCONST;
t = TUVLONG;
@@ -867,7 +860,9 @@
t = TVLONG;
goto nret;
}
- if(c1 & Numlong) {
+ if(c1 & Numlong ||
+ convvtox(vv, TULONG) > convvtox(vv, TUINT) ||
+ (c1 & (Numdec|Numuns)) == Numdec && convvtox(vv, TINT) < 0) {
if((c1 & Numuns) || convvtox(vv, TLONG) < 0) {
c = LULCONST;
t = TULONG;
--
9fans: 9fans
Permalink:
https://9fans.topicbox.com/groups/9fans/T22754f10b241991c-Mefe97ddcd27aad8f1a072269
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
--- /n/9front/sys/src/cmd/cc/lex.c Wed Apr 6 14:45:26 2022
+++ /tmp/lex.c Thu Apr 21 08:39:14 2022
@@ -848,16 +848,9 @@
yyerror("overflow in constant");
vv = yylval.vval;
- /*
- * c99 is silly: decimal constants stay signed,
- * hex and octal go unsigned before widening.
- */
- w = 32;
- if((c1 & (Numdec|Numuns)) == Numdec)
- w = 31;
- if(c1 & Numvlong || (c1 & Numlong) == 0 && (uvlong)vv >= 1ULL< convvtox(vv, TULONG) ||
+ (c1 & (Numdec|Numuns)) == Numdec && convvtox(vv, TLONG) < 0) {
if((c1 & Numuns) || convvtox(vv, TVLONG) < 0) {
c = LUVLCONST;
t = TUVLONG;
@@ -867,7 +860,9 @@
t = TVLONG;
goto nret;
}
- if(c1 & Numlong) {
+ if(c1 & Numlong ||
+ convvtox(vv, TULONG) > convvtox(vv, TUINT) ||
+ (c1 & (Numdec|Numuns)) == Numdec && convvtox(vv, TINT) < 0) {
if((c1 & Numuns) || convvtox(vv, TLONG) < 0) {
c = LULCONST;
t = TULONG;