This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++.old-deja/g++.mike/p7325.C - suspected bogus test case


Ian Lance Taylor wrote:
For example, here is a quickie test for whether arrays declared in
different blocks overlap.  This test appears to currently always fail.

See bug #9997 which has a 4 line patch (only two lines of actual code) that fixes this. It just needs someone to test the patch. This is in my backlog of stuff to look at some day, but it is probably faster if someone else does it.


This patch does not work for Ian's testcase because of a technicality. We call expand_expr with ignore==1 and target==const0_rtx, which eventually calls expand_builtin, which calls expand_builtin_memset, which returns a value even though we clearly said we didn't want one. Since we have a return value, the stack temporaries code gets confused and thinks we have a ({ }) construct instead of a { } construct, and that we might have a return value that refers to the array, so we need to keep it live past the end of the imaginary ({ }) construct. This shouldn't be hard to fix. We just need to make sure expand_builtin does not return a value when it isn't supposed to. It looks like this problem has been around for a very long time. gcc-2.0 appears to have the same problem, just from looking at the source code.

I don't know if either of these effects the p7325.C testcase. I didn't check.

By the way, if p7325.C uses TARGET_EXPR, then that could be why it is broken. There have been a number of changes to the lifetimes of stack slots generated for TARGET_EXPRs, including one Ulrich Wiegand made a couple of months ago.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]