Path: 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 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