🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by James Clark Tue, 21 Mar 1989 13:05
1.34.1 sparc bug
#1787
Author: James Clark
Date: Tue, 21 Mar 1989 13:05
96 lines
2479 bytes
G++ generates incorrect output from the following program.  It
generates correct output if the order of declarations in `struct node'
is reversed.

Script started on Tue Mar 21 12:55:23 1989
jclark% cat bug.c
#include <stdio.h>

struct node {
  void foo();
  virtual void foo(int);
};

struct dnode : public node {
  void foo(int);
};


main()
{
  node *n = new dnode;
  n->foo();
}

void node::foo()
{
  foo(1);
}

void node::foo(int n)
{ 
  puts("node::foo(int)");
}

void dnode::foo(int n) 
{ 
  puts("dnode::foo(int)");
}

jclark% g++ -v bug.c
g++ version 1.34.1
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ bug.c /tmp/cca04659.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca04659.cpp -quiet -dumpbase bug.c -version -o /tmp/cca04659.s
GNU C++ version 1.34.1 (sparc) compiled by GNU C version 1.34.
 as /tmp/cca04659.s -o bug.o
 /usr/local/lib/gcc-ld++ -C -e start -dc -dp /usr/local/lib/crt0+.o bug.o -lg++ /usr/local/lib/gcc-gnulib -lc
jclark% a.out
node::foo(int)
jclark% cat bug.c
#include <stdio.h>

struct node {
  virtual void foo(int);
  void foo();
};

struct dnode : public node {
  void foo(int);
};


main()
{
  node *n = new dnode;
  n->foo();
}

void node::foo()
{
  foo(1);
}

void node::foo(int n)
{ 
  puts("node::foo(int)");
}

void dnode::foo(int n) 
{ 
  puts("dnode::foo(int)");
}

jclark% g++ -v bug.c
g++ version 1.34.1
 /usr/local/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ bug.c /tmp/cca04666.cpp
GNU CPP version 1.34
 /usr/local/lib/gcc-c++ /tmp/cca04666.cpp -quiet -dumpbase bug.c -version -o /tmp/cca04666.s
GNU C++ version 1.34.1 (sparc) compiled by GNU C version 1.34.
 as /tmp/cca04666.s -o bug.o
 /usr/local/lib/gcc-ld++ -C -e start -dc -dp /usr/local/lib/crt0+.o bug.o -lg++ /usr/local/lib/gcc-gnulib -lc
jclark% a.out
dnode::foo(int)
jclark% exit
jclark% 
script done on Tue Mar 21 12:56:12 1989
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