OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [tree-ssa/] [pr20280.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
// PR c++/20280
// PR c++/20280
// { dg-do compile }
// { dg-do compile }
// Gimplification of the COND_EXPR used to fail because it had an
// Gimplification of the COND_EXPR used to fail because it had an
// addressable type, and create_tmp_var rejected that.
// addressable type, and create_tmp_var rejected that.
struct A
struct A
{
{
    ~A();
    ~A();
};
};
struct B : A {};
struct B : A {};
A& foo();
A& foo();
void bar(bool b)
void bar(bool b)
{
{
    (B&) (b ? foo() : foo());
    (B&) (b ? foo() : foo());
}
}
// Make sure bit-fields and addressable types don't cause crashes.
// Make sure bit-fields and addressable types don't cause crashes.
// These were not in the original bug report.
// These were not in the original bug report.
// Added by Alexandre Oliva 
// Added by Alexandre Oliva 
// Copyright 2005 Free Software Foundation
// Copyright 2005 Free Software Foundation
struct X
struct X
{
{
  long i : 32, j, k : 32;
  long i : 32, j, k : 32;
};
};
void g(long&);
void g(long&);
void h(const long&);
void h(const long&);
void f(X &x, bool b)
void f(X &x, bool b)
{
{
  (b ? x.i : x.j) = 1;
  (b ? x.i : x.j) = 1;
  (b ? x.j : x.k) = 2;
  (b ? x.j : x.k) = 2;
  (b ? x.i : x.k) = 3;
  (b ? x.i : x.k) = 3;
  (void)(b ? x.i : x.j);
  (void)(b ? x.i : x.j);
  (void)(b ? x.i : x.k);
  (void)(b ? x.i : x.k);
  (void)(b ? x.j : x.k);
  (void)(b ? x.j : x.k);
  g (b ? x.i : x.j); // { dg-error "cannot bind bitfield" }
  g (b ? x.i : x.j); // { dg-error "cannot bind bitfield" }
  g (b ? x.i : x.k); // { dg-error "cannot bind bitfield" }
  g (b ? x.i : x.k); // { dg-error "cannot bind bitfield" }
  g (b ? x.j : x.k); // { dg-error "cannot bind bitfield" }
  g (b ? x.j : x.k); // { dg-error "cannot bind bitfield" }
  // It's not entirely clear whether these should be accepted.  The
  // It's not entirely clear whether these should be accepted.  The
  // conditional expressions are lvalues for sure, and 8.5.3/5 exempts
  // conditional expressions are lvalues for sure, and 8.5.3/5 exempts
  // lvalues for bit-fields, but it's not clear that conditional
  // lvalues for bit-fields, but it's not clear that conditional
  // expressions that are lvalues and that have at least one possible
  // expressions that are lvalues and that have at least one possible
  // result that is a bit-field lvalue meets this condition.
  // result that is a bit-field lvalue meets this condition.
  h (b ? x.i : x.j);
  h (b ? x.i : x.j);
  h (b ? x.i : x.k);
  h (b ? x.i : x.k);
  h (b ? x.j : x.k);
  h (b ? x.j : x.k);
  (long &)(b ? x.i : x.j); // { dg-error "address of bit-field" }
  (long &)(b ? x.i : x.j); // { dg-error "address of bit-field" }
  (long &)(b ? x.i : x.k); // { dg-error "address of bit-field" }
  (long &)(b ? x.i : x.k); // { dg-error "address of bit-field" }
  (long &)(b ? x.j : x.k); // { dg-error "address of bit-field" }
  (long &)(b ? x.j : x.k); // { dg-error "address of bit-field" }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.