[gnu.gcc.bug] bad code from GCC 1.36

hrp@BORING.CRAY.COM (Hal Peterson) (12/07/89)

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