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]

Test for invalid optimization of ?: lvalue expression


I'm checking this in in g++.old-deja/g++.oliva:

// Copyright (C) 2000 Free Software Foundation

// by Alexandre Oliva <aoliva@cygnus.com>

// execution test - XFAIL *-*-*

int i, j;

const int &f(const int& I, const int& J) {
  // this must not be optimized to I because it's an lvalue
  return (I != J) ? I : J;
}

int main () {
  if (&f(i, j) != &j)
    abort ();
  exit (0);
}

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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