🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

(none)

#285
From: Mike Bolotski
Date: Mon, 17 Jul 1989 20:16
52 lines
1978 bytes
I found a bug in g++ that I have been unable to reproduce with a simple
test file, so I don't know whether this report is actually useful.  I'll
include the hopefully relevant pieces.


class CardSet {
       int   *set;
       short card;
..

class TwoSet  {
        CardSet th;                             
        CardSet on;                            

inline short TwoSet::Card()                     { return th.card; }

Node* Network::FindContainers(TwoSet* f, short* num, Node* fr=0)
{
  short count = 0;
  short j;
  register NodePtr q, root=0;
  short thresh = f->Card();
}

Here is the generated assembly code.

.globl _FindContainers_PSNetwork_PSNOR_PHI_PSNode
_FindContainers_PSNetwork_PSNOR_PHI_PSNode:
        link a6,#-4
        moveml #0x3f3c,sp@-
        movel a6@(12),d6              # f into d6
        movel a6@(20),a0
        clrw d5                       # count = 0
        clrl d4                       # root = 0
        movel d6,a5                   # f into a5
        movew a5@(4),a5               # card into a5
        movel a5,a6@(-4)              # BOOM: long instead of short move 


The bug goes away when the Card() is declared as int.  I realize that
this is the evil 'bug envelope' but I've been unable to reproduce it
with smaller files.

Installation info:

Sun 3/260 SunOS 4.0.1 g++ 1.35.1-
 

Mike Bolotski, Department of Electrical Engineering,
               University of British Columbia, Vancouver, Canada 
mikeb@ee.ubc.ca                    | mikeb%ee.ubc.ca@relay.ubc.ca
ee.ubc.ca!mikeb@uunet.uu.net       | ...!ubc-vision!ee.ubc.ca!mikeb
Technical Details
Message-ID: <215*mikeb@ee.ubc.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ee.ubc.ca!mikeb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ee.ubc.ca!mikeb
From: mikeb@ee.ubc.ca (Mike Bolotski)
Newsgroups: gnu.g++.bug
Subject: (none)
Message-ID: <215*mikeb@ee.ubc.ca>
Date: 17 Jul 89 20:16:00 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 52