Article View: comp.sources.bugs
Article #2300Perl 3.0 PL 8 triggers compiler bug
From: Kian-Tat Lim
Date: Fri, 05 Jan 1990 02:19
Date: Fri, 05 Jan 1990 02:19
41 lines
1739 bytes
1739 bytes
Description:
Some compilers may produce incorrect code for the large switch (*s)
in toke.c. In particular, it is essential that characters with the high
bit set be handled properly. If this is not the case, failures (most likely
accompanied by core dumps) will be experienced on comp.package, cmd.subval,
io.print, op.dbm, op.index, op.mkdir, op.pack, op.read, op.sort, op.substr,
and op.vec due to mishandling of sort, return, printf, and print followed
by a parenthesized expression.
Repeat-By:
On an FPS 500 running FPX 4.1.0, make perl and do a 'make test'.
On this system, the compiler generates a jump table for the switch but
fails to properly bounds check the character being switched on.
Fix:
*** toke.c.old Thu Jan 4 17:57:02 1990
--- toke.c Thu Jan 4 17:56:36 1990
***************
*** 154,159 ****
--- 154,168 ----
else
fprintf(stderr,"Tokener at %s\n",s);
#endif
+ #ifdef accel
+ if (*s & 128) {
+ if ((*s & 127) == '(')
+ *s++ = '(';
+ else
+ warn("Unrecognized character \\%03o ignored", *s++);
+ goto retry;
+ }
+ #endif
switch (*s) {
default:
if ((*s & 127) == '(')
--
Kian-Tat Lim (ktl@wagvax.caltech.edu, KTL @ CITCHEM.BITNET, GEnie: K.LIM1)
Technical Details
Message-ID:
<13147@cit-vax.Caltech.Edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!cit-vax!ktlShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!cit-vax!ktl From: ktl@wag240.caltech.edu (Kian-Tat Lim) Newsgroups: comp.sources.bugs,comp.lang.perl Subject: Perl 3.0 PL 8 triggers compiler bug Message-ID: <13147@cit-vax.Caltech.Edu> Date: 5 Jan 90 02:19:58 GMT Sender: news@cit-vax.Caltech.Edu Reply-To: ktl@wag240.caltech.edu (Kian-Tat Lim) Organization: California Institute of Technology, Pasadena, CA Lines: 41