Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Marvin Solomon
Sat, 23 Jan 1993 02:47
failure to munge template function name
Author: Marvin Solomon
Date: Sat, 23 Jan 1993 02:47
Date: Sat, 23 Jan 1993 02:47
123 lines
2781 bytes
2781 bytes
// Problem with template functions in g++ version 2.3.3
// The compiler appears to be forgetting to munge the names of the functions
// it generates for version of g (they are both called "g"). Needless to say,
// the assembler is not very happy about it. Under Ultrix, the message is
//
// as0: Error: bug3.c, line 10: .ent must precede the definition of the symbol g
// as0: Error: bug3.c, line 10: Conflicting definition of symbol g
//
// (twice). The generated assembly code is reproduced below. Note the
// two copies of "g": one that calls O__Fc and one that calls O__Fi.
void O(char);
void O(int);
template <class Arg>
class Template {
public:
Arg i;
};
template <class Arg> void g(Template<Arg> &x) { O(x.i); }
void f() {
Template<int> ti;
Template<char> tc;
g(ti);
g(tc);
}
/*
.file 1 "bug3.c"
# GNU C++ 2.3.3 [AL 1.1, MM 33] DECstation running ultrix compiled by GNU C
# Cc1 defaults:
# Cc1 arguments (-G value = 8, Cpu = default, ISA = 1):
# -quiet -dumpbase -o
gcc2_compiled.:
.text
.align 2
.globl f__Fv
.loc 1 22
.ent f__Fv
f__Fv:
.frame $fp,32,$31 # vars= 8, regs= 2/0, args = 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,32
sw $31,28($sp)
sw $fp,24($sp)
move $fp,$sp
addu $4,$fp,16
jal g
addu $2,$fp,20
move $4,$2
jal g
j $L2
j $L1
$L2:
$L1:
move $sp,$fp # sp not trusted here
lw $31,28($sp)
lw $fp,24($sp)
addu $sp,$sp,32
j $31
.end f__Fv
.align 2
.loc 1 20
.ent g
g:
.frame $fp,24,$31 # vars= 0, regs= 2/0, args = 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,24
sw $31,20($sp)
sw $fp,16($sp)
move $fp,$sp
sw $4,24($fp)
lw $2,24($fp)
lb $3,0($2)
move $4,$3
jal O__Fc
j $L4
j $L3
$L4:
$L3:
move $sp,$fp # sp not trusted here
lw $31,20($sp)
lw $fp,16($sp)
addu $sp,$sp,24
j $31
.end g
.align 2
.loc 1 20
.ent g
g:
.frame $fp,24,$31 # vars= 0, regs= 2/0, args = 16, extra= 0
.mask 0xc0000000,-4
.fmask 0x00000000,0
subu $sp,$sp,24
sw $31,20($sp)
sw $fp,16($sp)
move $fp,$sp
sw $4,24($fp)
lw $2,24($fp)
lw $4,0($2)
jal O__Fi
j $L6
j $L5
$L6:
$L5:
move $sp,$fp # sp not trusted here
lw $31,20($sp)
lw $fp,16($sp)
addu $sp,$sp,24
j $31
.end g
*/
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