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: [tree-ssa] mainline->branch merge status


On Jan 28, 2004, at 10:22 AM, Diego Novillo wrote:
A heads-up for those of us following SPEC results. The new merge brings
in the removal of assignments to non-lvalues. This produces a compile
error in 176.gcc:


reorg.c: In function `find_end_label':
reorg.c:831: error: invalid lvalue in increment
reorg.c: In function `delete_from_delay_slot':
reorg.c:1033: error: invalid lvalue in increment
reorg.c: In function `make_return_insns':
reorg.c:4157: error: invalid lvalue in increment
reorg.c: In function `dbr_schedule':
reorg.c:4237: error: invalid lvalue in increment
specmake: *** [reorg.o] Error 1

This comes from the old obstack.h file. I fixed the file, but cc1
miscompares at runtime. Maybe my fix is wrong, or maybe we've inherited
a bug from mainline. I still don't know.

Well, how did you fix it? The offending code is


*((void **)__o->next_free)++ = ((void *)datum); \

If you just break this into two in the obvious fashion

  { \
      *((void **)__o->next_tree) = ((void*)datum); \
      ((void **)__o->next_tree)++; \
  } \

the compiler thinks the store in the first statement interferes with the load
in the second. At a minimum that is not performance neutral (you have an
extra load), and if the compiler happens to be right that the memrefs interfere,
that code is also wrong. Maybe somebody familiar with obstacks can say whether that
can happen. I believe the following is correct, performance neutral, and
standard-conforming:


{ \
void ***t = (void ***)&(__o->next_free); \
**t = ((void *)datum); \
(*t)++; \
} \


(Also much harder to read, but such is the price of conformance :)

This works OK on ppc Darwin, but I haven't tried with your merge changes.


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