diff --git a/mach/proto/as/comm4.c b/mach/proto/as/comm4.c index a47d1438d..05255ba22 100644 --- a/mach/proto/as/comm4.c +++ b/mach/proto/as/comm4.c @@ -15,7 +15,7 @@ #include "comm0.h" #include "comm1.h" #include "y.tab.h" -#include +#include "object.h" extern YYSTYPE yylval; @@ -243,7 +243,8 @@ archive(void) { if (needed()) { fseek(input,offset,0); archsize = header.ar_size; - header.ar_name[14] = '\0'; + // TODO: To check if this is correct. + header.ar_name[AR_NAME_MAX-1] = '\0'; parse(remember(header.ar_name)); } offset += header.ar_size; @@ -330,7 +331,7 @@ parse(char *s) */ #ifdef ASLD for (i = 0; i < H_SIZE; i++) { - while (ip = hashtab[H_LOCAL+i]) { + while ((ip = hashtab[H_LOCAL+i])) { /* * cleanup local queue */ diff --git a/mach/proto/as/comm5.c b/mach/proto/as/comm5.c index 0b448ef0e..e8718bc46 100644 --- a/mach/proto/as/comm5.c +++ b/mach/proto/as/comm5.c @@ -439,7 +439,7 @@ static int innumber(int c) if (radix != 16 && (c == 'f' || c == 'b')) return (infbsym(num)); yylval.y_valu = 0; - while (c = *p++) + while ((c = *p++)) { if (c > '9') c -= ('a' - '9' - 1); @@ -593,7 +593,7 @@ int hash(const char* p) int c; h = 0; - while (c = *p++) + while ((c = *p++)) { h <<= 2; h += c; @@ -668,10 +668,16 @@ item_t* fb_shift(int lab) ip = fb_ptr[FB_FORW + lab]; if (ip == 0) + { if (pass == PASS_1) + { ip = fb_alloc(lab); + } else + { ip = fb_ptr[FB_HEAD + lab]; + } + } fb_ptr[FB_BACK + lab] = ip; fb_ptr[FB_FORW + lab] = ip->i_next; return (ip); diff --git a/mach/proto/as/comm6.c b/mach/proto/as/comm6.c index 8aca81e8a..404e08742 100644 --- a/mach/proto/as/comm6.c +++ b/mach/proto/as/comm6.c @@ -11,7 +11,7 @@ #include "comm0.h" #include "comm1.h" #include "y.tab.h" -#include +#include "object.h" static void new_common(item_t *); @@ -187,7 +187,7 @@ switchsect(int newtyp) { sect_t *sp; - if (sp = DOTSCT) + if ((sp = DOTSCT)) sp->s_size = DOTVAL - sp->s_base; if (newtyp == S_UND) { DOTSCT = NULL; @@ -212,10 +212,16 @@ align(valu_t bytes) if (bytes == 0) bytes = ALIGNWORD; if (sp->s_lign % bytes) + { if (bytes % sp->s_lign) + { serror("illegal alignment"); + } else + { sp->s_lign = bytes; + } + } if (pass == PASS_1) /* * be pessimistic: biggest gap possible diff --git a/mach/proto/as/comm7.c b/mach/proto/as/comm7.c index 5611e8272..418bf363c 100644 --- a/mach/proto/as/comm7.c +++ b/mach/proto/as/comm7.c @@ -13,7 +13,7 @@ #include "comm1.h" #include "y.tab.h" #include -#include +#include "object.h" valu_t load(const item_t* ip) { @@ -77,7 +77,7 @@ char* remember(char* s) assert(nleft >= 0); } p = next; - while (*p++ = *s++) + while ((*p++ = *s++)) ; s = next; next = p; @@ -133,7 +133,7 @@ int printx(int ndig, valu_t val) } while (--n); do { - c = "0123456789ABCDEF"[*--p]; + c = "0123456789ABCDEF"[(unsigned char)*--p]; putchar(c); } while (p > buf); return (ndig); @@ -232,6 +232,8 @@ int small(int fitsmall, int gain) case PASS_3: assert(fitsmall || (*p & bit) == 0); return (*p & bit); + default: + assert(0); } /*NOTREACHED*/ } @@ -368,7 +370,7 @@ void emitstr(int zero) #endif #define gen1 emit1 -#include +#include "con_float" void emitf(int size, int negative) {