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 c++/47541] [4.5/4.6 Regression] For integer pointers, the value of ++*p is not written back to memory


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

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-31 16:40:11 UTC ---
Testcase:

struct Dummy {};
struct RefCount : public Dummy {
    ~RefCount(); /* Has to be non-pod.  */
    int *a;
    int *b;
};
RefCount::~RefCount(){}
struct Wrapper : public Dummy { RefCount ref; };
void __attribute__((noinline,noclone))
Push(Wrapper ptr)
{
  *ptr.ref.b = 0;
}
extern "C" void abort (void);
int main()
{
  int a = 1, b = 1;
  Wrapper x;
  x.ref.a = &a;
  x.ref.b = &b;
  Push(x);
  if (b != 0)
    abort ();
  return 0;
}


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