[gnu.g++.bug] G++ 1.36.1, Sun4-os4, more

eichin@ATHENA.MIT.EDU (Mark W. Eichin) (11/30/89)

// The following code under all options should print 111 222 333.
// Under g++ 1.36.1 sun4-os4, I get f7fffe08 111 222.
// If I punt the body of bam::bam (so that it doesn't actually use
// builtin_saveregs, ie. va_start) it works fine. Also, if I change
// bar::bar from taking a loseme& to a loseme (copy instead of ref)
// it also works.
// THE TRICKY PART: this goes right into the expand_builtin code that
// I reported earlier as not working at all (expr.c, line 3511, is the
// start of an infinite loop.) And in fact, this is derived from a
// case which triggered the loop... so the error reported above occurs
// in code generated from a *GCC* 1.36 expand_builtin (ie. I took out
// the part that was obviously broken.) 
// SO: can anyone tell me either (1) is there a patch to 1.36.1 that
// will solve the original looping problem (2) does this problem go
// away under 1.36.2 (3) what exactly was that loop *trying* to do, so
// maybe I can fix it?
//			Mark Eichin <eichin@athena.mit.edu>
				    
      
class loseme {
public:
  void *a;
  void *b;
  void *c;
  loseme(void*aa,void*bb,void*cc) { a=aa; b=bb; c=cc; };
};

class foo {
public:
  foo(loseme);
};

foo::foo(loseme lm) {
  printf("%x %x %x\n",lm.a,lm.b,lm.c);
};

class bar:public foo {
public:
  bar(loseme&);
};

bar::bar(loseme& lm):(lm) { }

#include <stdarg.h>
class bam:public bar {
public:
  bam(loseme,...);
};

bam::bam(loseme lm, ...):(lm) {
  va_list ap;
  va_start(ap,lm);
  va_end(ap);
}

int main(int,char**) {
  bam(loseme((void*)0x111,(void*)0x222,(void*)0x333));
}
// end of code
				Mark Eichin <eichin@athena.mit.edu>