This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Test for invalid optimization of ?: lvalue expression
- To: gcc-patches at gcc dot gnu dot org
- Subject: Test for invalid optimization of ?: lvalue expression
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 28 May 2000 11:18:47 -0300
- Organization: Cygnus Solutions, a Red Hat Company
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