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: [patch] PR 33653: don't optimize volatile mem accesses


Hi,

On Thu, 4 Oct 2007, Paolo Bonzini wrote:

> > Is it possible in our testsuite to check that RTL doesn't optimize 
> > away the volatile read?
> 
> You could make it p[5678] and scan RTL dumps for 5678?

I like that idea.  But it doesn't seem to work for machines which split 
immediates.  I now think (after trying with signals, which would require 
limiting the number of test platforms) that it's enough to simply check 
for "mem/v" in any late dump.  I chose "shorten" as it seems to be the 
latest one which is run on all platforms.

So, I'll use the below as gcc.dg/pr33653.c.


Ciao,
Michael.

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-rtl-shorten" } */

void f (volatile char *p)
{
  char c = p[0];
}

/* { dg-final { scan-rtl-dump "mem/v" "shorten" } } */
/* { dg-final { cleanup-rtl-dump "shorten" } } */


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