Thread View: gnu.g++.bug
1 messages
1 total messages
Started by Tom Vijlbrief
Wed, 18 Jan 1989 13:00
g++ 1.27 does not generate warning
Author: Tom Vijlbrief
Date: Wed, 18 Jan 1989 13:00
Date: Wed, 18 Jan 1989 13:00
64 lines
1610 bytes
1610 bytes
G++ 1.27 does generate a warning when a reference to a
local automatic variable is returned, but NOT when a reference to an
expression is returned.
int &test1()
{
int a= 3;
return a; // Warning produced
}
int &test2()
{
return 3; // No warning produced !!!
}
===================================================
The generated code is identical for both functions:
===================================================
#NO_APP
.text
.even
.globl _test1
_test1:
link a6,#-4
movel d2,sp@-
moveq #3,d1
movel d1,a6@(-4)
movel a6,d2
subql #4,d2
movel d2,d0
jra L1
L1:
movel a6@(-8),d2
unlk a6
rts
.even
.globl _test2
_test2:
link a6,#-4
movel d2,sp@-
moveq #3,d1
movel d1,a6@(-4)
movel a6,d2
subql #4,d2
movel d2,d0
jra L2
L2:
movel a6@(-8),d2
unlk a6
rts
===================================
===============================================================================
Tom Vijlbrief
TNO Institute for Perception
P.O. Box 23 Phone: +31 34 63 62 77
3769 ZG Soesterberg E-mail: tnosoes!tom@mcvax.cwi.nl
The Netherlands or: uunet!mcvax!tnosoes!tom
===============================================================================
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