🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Mike Bolotski Mon, 17 Jul 1989 20:16
(none)
#285
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads