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/18842] Weak optimization on global references


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-05 15:14 -------
Consider these two TUs:
extern int *y, x, z;
int foo();
extern "C" void abort();
int main()
{
  foo();
  if (*y!=42)
   abort();
  if (y!=&x)
   abort();
  y = &z;
  foo ();
  if (*y!=42)
   abort();
  if (y!=&z)
   abort();
  return 0;
}
-----
int x, &y = x, z; 
int foo() { y = 42; } 
-----
Now I think the above is invalid C++ but we don't have to diagnostic since the standard allows us not 
to but since the standard allows the correct way, we can optimizate global references now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |tree-optimization
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-05 15:14:15
               date|                            |


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


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