This is the mail archive of the gcc-patches@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: [RFC] PR64703, glibc sysdeps/powerpc/powerpc64/dl-machine.h miscompile


On Fri, Jan 30, 2015 at 01:19:51PM +1030, Alan Modra wrote:
> On Thu, Jan 29, 2015 at 04:21:15PM +0100, Richard Biener wrote:
> > > This means that you still will be able to create a testcase that is
> > > miscompiled with exposing the address-taking to points-to analysis.
> 
> I'm sorry, I don't see how to.  (I'm not disagreeing, just ignorant.)

Sigh.  Yes, I can make such a testcase.

typedef struct {
  unsigned long fd_func;
  unsigned long fd_toc;
  unsigned long fd_aux;
} Elf64_FuncDesc;

int a, b;

int
foo (__attribute__((const)) int (*f) (int), long adjust)
{
  Elf64_FuncDesc opd;

  a = 1;
  b = 2;
  if (adjust)
    {
      opd = *(Elf64_FuncDesc *) f;
      opd.fd_func += adjust;
      f = (int (*) (int)) &opd;
    }
  int c = f (3);
  a = 3;
  b = 4;
  return c;
}

This time we lose in .032t.cddce1.

-- 
Alan Modra
Australia Development Lab, IBM


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