🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #644

G++ 1.36.1, Sun4-os4, more (or same?) builtin_saveregs lossage

#644
From: Mark W. Eichin
Date: Thu, 30 Nov 1989 03:25
60 lines
2103 bytes
// 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>
Technical Details
Message-ID: <8911300325.AA02797@E40-008-8.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!eichin

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ATHENA.MIT.EDU!eichin
From: eichin@ATHENA.MIT.EDU (Mark W. Eichin)
Newsgroups: gnu.g++.bug
Subject: G++ 1.36.1, Sun4-os4, more (or same?) builtin_saveregs lossage
Message-ID: <8911300325.AA02797@E40-008-8.MIT.EDU>
Date: 30 Nov 89 03:25:15 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 60