This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/32721] New: CCP removes volatile qualifiers.


With today's trunk on a private port . consider the following testcase. 


volatile int spinlock[2];
void main (void)
{
volatile int * spinlock0;
volatile int * spinlock1;
spinlock0 = &spinlock[0];
spinlock1 = &spinlock[1];

*spinlock0 = 0;
*spinlock1 = 0;
 while (*spinlock0);
}

CCP folds this into the following form 
Simulating block 4

Simulating block 3

Substituing values and folding statements

Folded statement: *spinlock0_1 = 0;
            into: spinlock[0] = 0;

Folded statement: *spinlock1_2 = 0;
            into: spinlock[1] = 0;

Folded statement: D.1498_3 = *spinlock0_1;
            into: D.1498_3 = spinlock[0];

main ()
{
  volatile int * spinlock1;
  volatile int * spinlock0;
  int D.1498;

<bb 2>:
  spinlock0_1 = &spinlock[0];
  spinlock1_2 = &spinlock[1];
  spinlock[0] = 0;
  spinlock[1] = 0;

<bb 3>:
  D.1498_3 = spinlock[0]; ---> This folding seems to be wrong. 
  if (D.1498_3 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 4>:
  return;

}


-- 
           Summary: CCP removes volatile qualifiers.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ramana dot radhakrishnan at celunite dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32721


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