Force -O0 in 2004/burley - optimiser breaks it

This commit is contained in:
Cody Boone Ferguson committed 2023-12-19 10:00:49 -08:00
1 parent d2f02075f6
commit 526f04d84f
3 files changed
+12 -6

No files matched your search

+5 -2
View File
@@ -66,7 +66,8 @@ CINCLUDE= -include stdio.h -include setjmp.h -include string.h -include time.h -
# Optimization # Optimization
# #
OPT= # We DISABLE the optimiser because having it enabled BREAKS the program.
OPT= -O0
# Default flags for ANSI C compilation # Default flags for ANSI C compilation
# #
@@ -131,8 +132,10 @@ all: data ${TARGET}
clean clobber install love haste waste maker easter_egg \ clean clobber install love haste waste maker easter_egg \
sandwich supernova deep_magic magic charon pluto sandwich supernova deep_magic magic charon pluto
# NOTE: We FORCE the use of -O0 even if someone overrides it because this entry
# will not work with it enabled.
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} ${CC} ${CFLAGS} -O0 $< -o $@ ${LDFLAGS}
# alternative executable # alternative executable
# #
+3
View File
@@ -4,6 +4,9 @@
make make
``` ```
NOTE: We FORCE the use of -O0 even if someone overrides it because this entry
will not work with it enabled.
## To use: ## To use:
+4 -4
View File
@@ -2665,16 +2665,16 @@ For clang the problem was that `main()` had one arg, a `char *` and this is not
allowed in any version of clang. In some versions it is allowed if the arg is an allowed in any version of clang. In some versions it is allowed if the arg is an
`int` but never if it's anything else. To get it to work took numerous changes. `int` but never if it's anything else. To get it to work took numerous changes.
First the inclusion of `setjmp.h` was necessary. Without this `longjmp()` First the inclusion of `setjmp.h` was necessary. Without this `longjmp(3)`
implicitly returned int which was used for the purpose of binary expression but implicitly returned `int` which was used for the purpose of binary expression but
this no longer worked. this no longer worked.
But by including `setjmp.h` it naturally made the binary expressions invalid (as But by including `setjmp.h` it naturally made the binary expressions invalid (as
it returns void which no longer is allowed in binary expressions) so the comma it returns `void` which is not allowed in binary expressions) so the comma
operator with `0` (`,0`) had to be used (`,1` was tried first but this did not operator with `0` (`,0`) had to be used (`,1` was tried first but this did not
work right). work right).
`longjmp()` was being called with one arg which was an element `longjmp(3)` was being called with one arg which was an element
of an `int[4][1000]` which had to be changed to a `jmp_buf p[4]` (this due to of an `int[4][1000]` which had to be changed to a `jmp_buf p[4]` (this due to
the prototype being included). the prototype being included).