fix: may no address more memory than is present blocks.c

This commit is contained in:
ceriel 1987-08-03 14:04:44 +00:00
parent 116a0f81f5
commit 1640b8cad8
3 changed files with 14 additions and 15 deletions

View file

@ -13,12 +13,13 @@ EMKLIB = $(EMHOME)/modules/lib/libemk.a
EMELIB = $(EMHOME)/modules/lib/libeme.a
STRLIB = $(EMHOME)/modules/lib/libstring.a
PRTLIB = $(EMHOME)/modules/lib/libprint.a
EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a
EMMESLIB = $(EMHOME)/modules/lib/libem_mesO.a
INPLIB = $(EMHOME)/modules/lib/libinput.a
ALLOCLIB = $(EMHOME)/modules/lib/liballoc.a
MALLOC = $(EMHOME)/modules/lib/malloc.o
LIBS = $(INPLIB) $(EMMESLIB) $(EMKLIB) $(PRTLIB) $(STRLIB) \
$(ALLOCLIB) $(MALLOC) $(SYSLIB)
LIBS = $(EMMESLIB) $(EMHOME)/modules/lib/libemopt.a $(EMHOME)/modules/lib/libread_emk.a \
$(INPLIB) $(EMKLIB) $(PRTLIB) $(STRLIB) \
$(ALLOCLIB) $(MALLOC) $(SYSLIB) $(EMHOME)/lib/em_data.a
ELIBS = $(INPLIB) $(EMMESLIB) $(EMELIB) $(PRTLIB) $(STRLIB) \
$(ALLOCLIB) $(MALLOC) $(SYSLIB)
LIB_INCLUDES = -I$(EMHOME)/modules/h -I$(EMHOME)/modules/pkg
@ -35,7 +36,7 @@ ALLOCLLIB = $(EMHOME)/modules/lib/llib-lalloc.ln
LINTLIBS = $(EMMESLLIB) $(EMKLLIB) $(PRTLLIB) $(STRLLIB) $(ALLOCLLIB) $(SYSLLIB)
CURRDIR = .
COPTIONS =
COPTIONS = -DPEEPHOLE
# What parser generator to use and how
GEN = $(EMHOME)/bin/LLgen
@ -118,12 +119,12 @@ Emain: Cfiles
@rm -f nmclash.o a.out
install: Main
rm -f $(EMHOME)/lib/em_cemcom $(EMHOME)/man/em_cemcom.6
cp $(CURRDIR)/main $(EMHOME)/lib/em_cemcom
rm -f $(EMHOME)/lib/em_cemcomO $(EMHOME)/man/em_cemcom.6
cp $(CURRDIR)/main $(EMHOME)/lib/em_cemcomO
cp $(CURRDIR)/cemcom.1 $(EMHOME)/man/em_cemcom.6
cmp: Main
-cmp $(CURRDIR)/main $(EMHOME)/lib/em_cemcom
-cmp $(CURRDIR)/main $(EMHOME)/lib/em_cemcomO
-cmp $(CURRDIR)/cemcom.1 $(EMHOME)/man/em_cemcom.6
pr:
@ -443,6 +444,7 @@ error.o: nopp.h
error.o: spec_arith.h
error.o: tokenname.h
field.o: Lpars.h
field.o: align.h
field.o: arith.h
field.o: assert.h
field.o: code.h
@ -678,7 +680,6 @@ conversion.o: spec_arith.h
conversion.o: target_sizes.h
conversion.o: type.h
util.o: align.h
util.o: atw.h
util.o: nocross.h
util.o: nofloat.h
util.o: sizes.h

View file

@ -72,7 +72,7 @@ COBJ = main.o idf.o declarator.o decspecs.o struct.o \
input.o domacro.o replace.o init.o options.o \
scan.o skip.o stack.o type.o ch7mon.o label.o eval.o \
switch.o conversion.o \
blocks.o dataflow.o Version.o
blocks.o dataflow.o Version.o util.o
# Objects of other generated C files
GOBJ = char.o symbol2str.o next.o
@ -80,7 +80,7 @@ GOBJ = char.o symbol2str.o next.o
# generated source files
GSRC = char.c symbol2str.c next.c \
code.h declar.h decspecs.h def.h expr.h field.h estack.h \
idf.h macro.h stack.h stmt.h struct.h switch.h type.h
idf.h macro.h stack.h stmt.h struct.h switch.h type.h util.h
# .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE!
GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \
@ -95,7 +95,7 @@ GENERATED = tab tokenfile.g Lpars.h LLfiles LL.output lint.out \
# include files containing ALLOCDEF specifications
NEXTFILES = code.str declar.str decspecs.str def.str expr.str field.str \
estack.str \
estack.str util.str \
idf.str macro.str stack.str stmt.str struct.str switch.str type.str
.SUFFIXES: .str .h
@ -149,6 +149,7 @@ stmt.h: make.allocd
struct.h: make.allocd
switch.h: make.allocd
type.h: make.allocd
util.h: make.allocd
# Objects needed for 'main'
OBJ = $(COBJ) $(LOBJ) $(GOBJ)

View file

@ -96,11 +96,8 @@ load_block(sz, al)
{
arith esz = ATW(sz); /* effective size == actual # pushed bytes */
if ((sz == al) && (word_align % al == 0))
if (((sz == al) && (word_align % al == 0)) || (al % word_align == 0))
C_loi(sz);
else
if (al % word_align == 0)
C_loi(esz);
else {
#ifndef STB
arith src, dst;