Path: utzoo!telly!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!xanth!mcnc!rti!xyzzy!wood From: wood@dg-rtp.dg.com (Tom Wood) Newsgroups: gnu.gcc.bug Subject: Re: struct expression bug in gcc 1.36 Message-ID: <260@xyzzy.UUCP> Date: 13 Nov 89 14:46:31 GMT References: <8911020044.AA23287@llw1.local> Sender: usenet@xyzzy.UUCP Reply-To: wood@gen-rtx.dg.com () Distribution: gnu Organization: Data General Corporation, Research Triangle Park, NC Lines: 22 In article <8911020044.AA23287@llw1.local> bothner@llw1.mit.edu writes: > In this test program, two constant struct Any expressions are used. > however, the compiler only allocates one global for both, > so the second has an incorrect value. This occurs in varasm.c in both 1.35 and 1.36 versions. The problem is in the way constant descriptors encode ADDR_EXPR elements. It just so happened (because ParsePlus() and ParseMinus() had identical form) that the rtl address for value.base returned by decode_addr_const() was the same for &Plus as it was for &Minus. Since these addresses are only valid for the life of the function, this comparison is flawed. A quick and dirty solution would be to expand the encoding for ADDR_EXPR elements to include a UID based on the function name. I suspect there's a better solution. If you want to browse the problem, step throught compare_constant\varasm.c and in particular pay attention to what decode_addr_const\varasm.c returns. --- Tom Wood (919) 248-6067 Data General, Research Triangle Park, NC {the known world}!rti!xyzzy!wood