[gnu.gcc.bug] struct expression bug in gcc 1.36

wood@dg-rtp.dg.com (Tom Wood) (11/13/89)

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