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 rtl-optimization/16536] [3.3/3.4 regression] Incorrect __restrict__ optimization in -O2


------- Additional Comments From bangerth at dealii dot org  2004-07-14 15:50 -------
Here is something a little more obvious (maybe): 
------------------ 
extern "C" void abort (); 
 
struct S {  
    float u, dummy; 
};  
  
inline S add (const S& a,const S& b) 
{ return (S) { a.u+b.u, 0 }; }  
  
void foo(S * __restrict__ v0,  
         S * __restrict__ v1,  
         S * __restrict__ v2) 
{ 
                                   // add copy v2 of v0 and v1; write result 
                                   // into v0 
  (*v2) = (*v0);  
  (*v0) = add(*v2, *v1); 
 
  if (v0->u != 2) 
    abort (); 
}  
  
int main()  
{  
  S v0={1}, v1={1}, v2;    
  foo(&v0,&v1,&v2);  
}  
---------------------------- 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -O2 x.cc ; ./a.out  
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -O2 x.cc ; ./a.out  
Aborted 
 
W. 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-14 15:50:21
               date|                            |


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


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