Article View: gnu.gcc.bug
Article #849bad code from GCC 1.36
From: Hal Peterson
Date: Wed, 06 Dec 1989 20:34
Date: Wed, 06 Dec 1989 20:34
26 lines
1146 bytes
1146 bytes
I am using GCC 1.36 on Sun-3 systems running under SunOS 3.5.
The following code unconditionally sets "bar" to zero.
extern char *strcpy(), *malloc();
main ()
{
char *bar;
bar = (("all") == 0 ? 0 : (strcpy(malloc((unsigned)strlen("all") + 1), "all")));
printf ("bar is 0x%lx\n", bar);
}
Here is the relevant 68K assembly code, built with "gcc -g -S":
.stabd 68,0,5
clrl a6@(-4)
.stabd 68,0,6
This is a nasty problem, because code of the form shown above is
generated by the XtNewString macro in X11R4.
--
Hal Peterson Domain: hrp@cray.com
Cray Research Old style: hrp%cray.com@uc.msc.umn.edu
1440 Northland Dr. UUCP: uunet!cray!hrp
Mendota Hts, MN 55120 USA Telephone: +1 612 681 3145
Technical Details
Message-ID:
<8912062034.AA06192@rothko.cray.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!BORING.CRAY.COM!hrpShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!BORING.CRAY.COM!hrp From: hrp@BORING.CRAY.COM (Hal Peterson) Newsgroups: gnu.gcc.bug Subject: bad code from GCC 1.36 Message-ID: <8912062034.AA06192@rothko.cray.com> Date: 6 Dec 89 20:34:50 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 26