davidgiven / ack

The Amsterdam Compiler Kit
http://tack.sf.net
Other
420 stars 59 forks source link

Mysterious build failures #218

Closed davidgiven closed 3 years ago

davidgiven commented 4 years ago

I (and other people) are seeing sporadic build failures. e.g.:

FAILED: /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/Lpars.c /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/Lpars.h /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/tokenfile.c /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/expression.c 
cd /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen && rm -f /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/Lpars.c /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/Lpars.h /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/tokenfile.c /tmp/ack-build/obj/lang/cem/cpp.ansi/llgen/expression.c && /tmp/ack-build/obj/util/LLgen/llgen/llgen /tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g /home/dtrg/nonshared/ack/lang/cem/cpp.ansi/expression.g 
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 1: (Warning) terminal IDENTIFIER not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 2: (Warning) terminal STRING not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 3: (Warning) terminal FILESPECIFIER not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 5: (Warning) terminal PLUSAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 6: (Warning) terminal MINAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 7: (Warning) terminal TIMESAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 8: (Warning) terminal DIVAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 9: (Warning) terminal MODAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 10: (Warning) terminal LEFTAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 11: (Warning) terminal RIGHTAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 12: (Warning) terminal ANDAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 13: (Warning) terminal XORAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 14: (Warning) terminal ORAB not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 17: (Warning) terminal PLUSPLUS not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 18: (Warning) terminal MINMIN not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 19: (Warning) terminal ARROW not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 26: (Warning) terminal ELLIPSIS not used
"/tmp/ack-build/obj/lang/cem/cpp.ansi/tokenfile_g/tokenfile.g", line 27: (Warning) terminal ERRONEOUS not used
llgen: util/LLgen/src/gencode.c:1083: getaction: Assertion `ch == '\0'' failed.
Aborted (core dumped)

and

FAILED: /tmp/ack-build/obj/lang/basic/src/em_bem/em_bem 
gcc -o /tmp/ack-build/obj/lang/basic/src/em_bem/em_bem /tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a /tmp/ack-build/obj/modules/src/alloc/lib/lib.a /tmp/ack-build/obj/modules/src/em_code/lib_k/lib_k.a /tmp/ack-build/obj/modules/src/em_data/lib/lib.a /tmp/ack-build/obj/modules/src/em_mes/lib/lib.a /tmp/ack-build/obj/modules/src/print/lib/lib.a /tmp/ack-build/obj/modules/src/string/lib/lib.a /tmp/ack-build/obj/modules/src/system/lib/lib.a /tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a /tmp/ack-build/obj/modules/src/alloc/lib/lib.a /tmp/ack-build/obj/modules/src/em_code/lib_k/lib_k.a /tmp/ack-build/obj/modules/src/em_data/lib/lib.a /tmp/ack-build/obj/modules/src/em_mes/lib/lib.a /tmp/ack-build/obj/modules/src/print/lib/lib.a /tmp/ack-build/obj/modules/src/string/lib/lib.a /tmp/ack-build/obj/modules/src/system/lib/lib.a 
/tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a(Lpars.o): In function `LLscan':
/tmp/ack-build/obj/lang/basic/src/llgen/Lpars.c:507: undefined reference to `LLnc_recover'
/tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a(Lpars.o): In function `LLread':
/tmp/ack-build/obj/lang/basic/src/llgen/Lpars.c:535: undefined reference to `LLnc_recover'
/tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a(Lpars.o): In function `LLerror':
/tmp/ack-build/obj/lang/basic/src/llgen/Lpars.c:582: undefined reference to `LLnc_recover'
/tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a(Lpars.o): In function `LLsafeerror':
/tmp/ack-build/obj/lang/basic/src/llgen/Lpars.c:641: undefined reference to `LLnc_recover'
/tmp/ack-build/obj/lang/basic/src/em_bem/main/em_bem/main.a(Lpars.o): In function `LLskip':
/tmp/ack-build/obj/lang/basic/src/llgen/Lpars.c:777: undefined reference to `LLnc_recover'
collect2: error: ld returned 1 exit status

They seem related to llgen. valgrind has found one use of uninitialised data there, which I've fixed, and I'll see if it makes the problems more or less severe.

tkchia commented 3 years ago

Hello @davidgiven,

I am getting the undefined reference to `LLnc_recover' error --- in particular, when I try building ACK on Launchpad (e.g.). Interestingly, this error appears very consistently (not sporadically) when I build on Launchpad.

Hope this information is useful.

Thank you!

tkchia commented 3 years ago

Hello @davidgiven,

It seems that some string buffer --- I am not sure which --- was overflowing into the non_corr variable in some situations. This made non_corr non-zero when it should be zero. The problem can be highlighted more clearly with this (temporary) patch:

diff --git a/util/LLgen/src/gencode.c b/util/LLgen/src/gencode.c
index 81572de93..be391ee80 100644
--- a/util/LLgen/src/gencode.c
+++ b/util/LLgen/src/gencode.c
@@ -115,6 +115,10 @@ STATIC void genhdr(void)
        fputs("#define LLNOFIRSTS\n", fpars);
 #ifdef NON_CORRECTING
    if (non_corr) fputs("#define LL_NON_CORR 1\n", fpars);
+/***/
+   if (non_corr) fprintf(stderr, "LL_NON_CORR! %#x %#x %#x\n",
+       non_corr, (&non_corr)[1], (&non_corr)[-1]);
+/***/
 #endif
    fprintf(fpars, "#define LL_LEXI %s\n", lexical);
    copyfile(incl_file);

Thank you!

davidgiven commented 3 years ago

I think this is now fixed!