Article View: comp.bugs.sys5
Article #1162Sys V.3.2 (386) cc bug: alloca & inlining
From: Carl Mascott
Date: Fri, 15 Jul 1994 14:04
Date: Fri, 15 Jul 1994 14:04
40 lines
2196 bytes
2196 bytes
I just spent the better part of a day figuring out why the module glob.c from GNU make 3.71 (and some previous versions) bombs if compiled with -O using pcc on AT&T System V/386 R3.2. It bombs in function glob_in_dir(). It only bombs if libPW(alloca.o) is used. If GNU alloca.c is used, it doesn't bomb. No, libPW(alloca.o) is not broken. It's pcc that is broken. Did you know that pcc's optimizer does function inlining? Well, it does. But not always correctly. It decided to inline my_realloc() in glob.c. The problem is that if the inlined function has parameters, and if a "real" alloca has been used in the calling function before the inlined function is invoked, the optimizer is unaware of the extra space created by alloca on the stack and fails to reference the inlined function's parameters. (It attempts to reference them as offsets from the calling function's frame pointer. The inlined function does not have its own frame pointer.) Neat, huh? Maybe some of those allegedly broken alloca's aren't broken after all... I guess that alloca needs to be a compiler built-in if the compiler does function inlining. By the way, pcc's optimizer takes lots of undocumented options. Anyone know what they do? Does anyone know if System V/386 R4's compiler has the same problem with alloca and function inlining? -- Carl Mascott cmascott@world.std.com uunet!world!cmascott
Technical Details
Message-ID:
<CszJ3r.Dw3@world.std.com>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!hookup!swrinde!pipex!sunic!trane.uninett.no!eunet.no!nuug!EU.net!uunet!world!cmascottShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6a6c,ce47c7932270f6,start X-Google-Attributes: gidf6a6c,public X-Google-Thread: 1025b4,ce47c7932270f6,start X-Google-Attributes: gid1025b4,public X-Google-Thread: f7cee,ce47c7932270f6,start X-Google-Attributes: gidf7cee,public X-Google-ArrivalTime: 1994-07-15 07:07:51 PST Newsgroups: comp.bugs.sys5,comp.unix.sys5.r3,gnu.misc.discuss Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!hookup!swrinde!pipex!sunic!trane.uninett.no!eunet.no!nuug!EU.net!uunet!world!cmascott From: cmascott@world.std.com (Carl Mascott) Subject: Sys V.3.2 (386) cc bug: alloca & inlining Message-ID: <CszJ3r.Dw3@world.std.com> Organization: The World Public Access UNIX, Brookline, MA Date: Fri, 15 Jul 1994 14:04:38 GMT Lines: 40