public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr
@ 2005-04-04 14:25 yanliu at ca dot ibm dot com
  2005-04-04 14:26 ` [Bug c++/20746] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: yanliu at ca dot ibm dot com @ 2005-04-04 14:25 UTC (permalink / raw)
  To: gcc-bugs

Using g++3.4.3 (gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)) to compile a 
testcase with covariant return types. In the testcase, the covariant function 
C::l() returns a null pointer, g++3.4.3 does the return value adjustment and 
returns a non-null return value ( which is incorrectly).
Here is the steps to reproduce the problem and the execution result:
>g++ t.C
>a.out 
in C* C::l
cp=0x8

-- 
           Summary: Incorrect return value for covariant return function
                    returning null ptr
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yanliu at ca dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
@ 2005-04-04 14:26 ` pinskia at gcc dot gnu dot org
  2005-04-04 14:35 ` pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-04 14:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-04 14:26 -------
*** Bug 20747 has been marked as a duplicate of this bug. ***

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
  2005-04-04 14:26 ` [Bug c++/20746] " pinskia at gcc dot gnu dot org
@ 2005-04-04 14:35 ` pinskia at gcc dot gnu dot org
  2005-04-04 14:39 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-04 14:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-04 14:35 -------
Test from 20747:
extern "C" void *printf(char * ...);
class A {
public:
virtual void f();
virtual A* i();
virtual void j();
int a;
};
class B  { 
public:
virtual void f();
virtual void g();
virtual B* l();
virtual void k();
int b;
};
class C : public A, public B{ 
public:
virtual void f(); 
virtual void g(); 
virtual void h(); 
virtual C* l(); 
virtual C* i(); 
int b;
};
main(){
C c;
B* bp=&c;
C* cp;
bp=bp->l();
printf("\ncp=%p\n",bp);
}
void A::f(){}
A* A::i(){}
void A::j(){}
void B::f(){}
void B::g(){}
void B::k(){}
B* B::l(){}
void C::f(){}
void C::g(){}
void C::h(){}
C* C::i(){}
C* C::l(){
printf("in C* C::l");
return 0;
}


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
  2005-04-04 14:26 ` [Bug c++/20746] " pinskia at gcc dot gnu dot org
  2005-04-04 14:35 ` pinskia at gcc dot gnu dot org
@ 2005-04-04 14:39 ` pinskia at gcc dot gnu dot org
  2005-04-04 14:43 ` nathan at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-04 14:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-04 14:38 -------
Confirmed, not a regression.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-04-04 14:38:56
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (2 preceding siblings ...)
  2005-04-04 14:39 ` pinskia at gcc dot gnu dot org
@ 2005-04-04 14:43 ` nathan at gcc dot gnu dot org
  2005-04-04 17:24 ` nathan at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-04-04 14:43 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-04-04 14:38:56         |2005-04-04 14:43:23
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (3 preceding siblings ...)
  2005-04-04 14:43 ` nathan at gcc dot gnu dot org
@ 2005-04-04 17:24 ` nathan at gcc dot gnu dot org
  2005-04-04 17:37 ` yanliu at ca dot ibm dot com
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-04-04 17:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2005-04-04 17:24 -------
2005-04-04  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/20746
	* method.c (use_thunk): Protect covariant pointer return
	adjustments from NULL pointers.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (4 preceding siblings ...)
  2005-04-04 17:24 ` nathan at gcc dot gnu dot org
@ 2005-04-04 17:37 ` yanliu at ca dot ibm dot com
  2005-04-04 17:37 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: yanliu at ca dot ibm dot com @ 2005-04-04 17:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From yanliu at ca dot ibm dot com  2005-04-04 17:37 -------
Could you tell me which gcc level has the fix? thanks. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (5 preceding siblings ...)
  2005-04-04 17:37 ` yanliu at ca dot ibm dot com
@ 2005-04-04 17:37 ` pinskia at gcc dot gnu dot org
  2005-04-04 17:45 ` cvs-commit at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-04 17:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (6 preceding siblings ...)
  2005-04-04 17:37 ` pinskia at gcc dot gnu dot org
@ 2005-04-04 17:45 ` cvs-commit at gcc dot gnu dot org
  2005-04-22  5:11 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-04 17:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-04 17:45 -------
Subject: Bug 20746

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2005-04-04 17:45:17

Modified files:
	gcc/cp         : ChangeLog method.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/abi: covariant5.C 

Log message:
	cp:
	PR c++/20746
	* method.c (use_thunk): Protect covariant pointer return
	adjustments from NULL pointers.
	testsuite:
	PR c++/20746
	* g++.dg/abi/covariant5.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4686&r2=1.4687
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.324&r2=1.325
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5277&r2=1.5278
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/abi/covariant5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (7 preceding siblings ...)
  2005-04-04 17:45 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-22  5:11 ` pinskia at gcc dot gnu dot org
  2005-06-30 21:00 ` scp at predict dot com
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-22  5:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-22 05:10 -------
*** Bug 18098 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris at kolpackov dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (8 preceding siblings ...)
  2005-04-22  5:11 ` pinskia at gcc dot gnu dot org
@ 2005-06-30 21:00 ` scp at predict dot com
  2005-07-01 11:39 ` nathan at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: scp at predict dot com @ 2005-06-30 21:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From scp at predict dot com  2005-06-30 21:00 -------
This fix has not made it to the gcc_4_0 branch, and the problem still exists in
gcc4.0.0. It is trivially recreated using the same test code:

gcc -v -o cv cv.cpp -lstdc++
Reading specs from
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/specs
Target: sparc-sun-solaris2.8
Configured with: ../sources/gcc-4.0.0/configure --prefix=/opt/csw/gcc4
--with-local-prefix=/opt/csw --without-gnu-as --with-as=/usr/ccs/bin/as
--without-gnu-ld --with-ld=/usr/ccs/bin/ld --enable-threads=posix
--enable-shared --enable-multilib --enable-nls --with-included-gettext
--with-libiconv-prefix=/opt/csw --with-x --enable-java-awt=xlib
--with-system-zlib --enable-languages=c,c++,f95,java,objc,ada
Thread model: posix
gcc version 4.0.0
 /usr/local/csw/gcc4/bin/../libexec/gcc/sparc-sun-solaris2.8/4.0.0/cc1plus
-quiet -v -iprefix
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/ cv.cpp -quiet
-dumpbase cv.cpp -mcpu=v7 -auxbase cv -version -o /var/tmp//cc6dpjVx.s
ignoring nonexistent directory
"/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../sparc-sun-solaris2.8/include"
ignoring duplicate directory
"/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../include/c++/4.0.0"
ignoring duplicate directory
"/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../include/c++/4.0.0/sparc-sun-solaris2.8"
ignoring duplicate directory
"/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../include/c++/4.0.0/backward"
ignoring duplicate directory
"/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0/include"
ignoring nonexistent directory
"/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../sparc-sun-solaris2.8/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../include/c++/4.0.0
 /usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../include/c++/4.0.0/sparc-sun-solaris2.8
 /usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/../../../../include/c++/4.0.0/backward
 /usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/include
 /opt/csw/include
 /opt/csw/gcc4/include
 /usr/include
End of search list.
GNU C++ version 4.0.0 (sparc-sun-solaris2.8)
        compiled by GNU C version 4.0.0.
GGC heuristics: --param ggc-min-expand=82 --param ggc-min-heapsize=98304
 /usr/ccs/bin/as -V -Qy -s -xarch=v8 -o /var/tmp//ccwNutZ8.o /var/tmp//cc6dpjVx.s
/usr/ccs/bin/as: Sun WorkShop 6 2003/12/18 Compiler Common 6.0 Patch 114802-02
 /usr/local/csw/gcc4/bin/../libexec/gcc/sparc-sun-solaris2.8/4.0.0/collect2 -V
-R /opt/csw/gcc4/lib -Y P,/opt/csw/gcc4/lib:/usr/ccs/lib:/usr/lib -Qy -o cv
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/crt1.o
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/crti.o
/usr/ccs/lib/values-Xa.o
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/crtbegin.o
-L/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0
-L/usr/local/csw/gcc4/bin/../lib/gcc
-L/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0 -L/usr/ccs/bin -L/usr/ccs/lib
-L/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/../../..
-L/opt/csw/gcc4/lib/gcc/sparc-sun-solaris2.8/4.0.0/../../.. /var/tmp//ccwNutZ8.o
-lstdc++ -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/crtend.o
/usr/local/csw/gcc4/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.0/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.293

% ./cv
in C* C::l
cp=8

Applying the patch to the gcc-4.0.0 release version fixes the problem:

http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.324&r2=1.325

How do I request that this fix be folded into the gcc_4_0 branch?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |scp at predict dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (9 preceding siblings ...)
  2005-06-30 21:00 ` scp at predict dot com
@ 2005-07-01 11:39 ` nathan at gcc dot gnu dot org
  2005-07-05 15:40 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-07-01 11:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2005-07-01 11:39 -------
(In reply to comment #8)
> This fix has not made it to the gcc_4_0 branch, and the problem still exists in
> gcc4.0.0. It is trivially recreated using the same test code:

the bug is not a regression, so it has not gone into 4.0.  As there seems to be
a need for it, and the patch is small, we could probably do it.  Right now 4.0
is frozen for 4.0.1 though

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (10 preceding siblings ...)
  2005-07-01 11:39 ` nathan at gcc dot gnu dot org
@ 2005-07-05 15:40 ` mmitchel at gcc dot gnu dot org
  2005-07-06 21:47 ` scp at predict dot com
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-05 15:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-07-05 15:40 -------
This is OK for 4.0.2, once the branch re-opens.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (11 preceding siblings ...)
  2005-07-05 15:40 ` mmitchel at gcc dot gnu dot org
@ 2005-07-06 21:47 ` scp at predict dot com
  2005-07-06 22:35 ` [Bug c++/20746] [4.0 only] " giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: scp at predict dot com @ 2005-07-06 21:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From scp at predict dot com  2005-07-06 21:47 -------
(In reply to comment #9)

> the bug is not a regression, so it has not gone into 4.0.  As there seems to be
> a need for it, and the patch is small, we could probably do it.  Right now 4.0
> is frozen for 4.0.1 though

Nathan,

4.0.2 is certainly fine by me. I've already applied the patch locally to 4.0.0,
and will continue to do so until it is folded in to 4.0.X.

I just wanted to clarify that there is a need for it for any code which has a
function returning a pointer to derived class instance which is then assigned to
a pointer to a virtual base class of that class type. I have plenty of
non-trivial code which does this which is why I discovered the problem and your
3.4.X fix.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] [4.0 only] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (12 preceding siblings ...)
  2005-07-06 21:47 ` scp at predict dot com
@ 2005-07-06 22:35 ` giovannibajo at libero dot it
  2005-07-12 11:30 ` cvs-commit at gcc dot gnu dot org
  2005-07-12 11:31 ` nathan at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: giovannibajo at libero dot it @ 2005-07-06 22:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-07-06 22:35 -------
I reopen the bug so we don't forget about this for 4.0.2.

Stephen, to clarify: we know that this is indeed a bug, and this is why it 
*was* fixed for 4.1. The fact is that the 4.0 serie is already out so we 
usually just consider regression fixes for it (that is, patches which fix 
problems appeared in 4.0 which were not present before). Since the code you 
provided never worked on any version of GCC, we assume it could wait another 
iteration up to 4.1. Anyway, Mark already approved it for 4.0.2 as an exception 
to the rule, so the fix will be present in that version.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
            Summary|Incorrect return value for  |[4.0 only] Incorrect return
                   |covariant return function   |value for covariant return
                   |returning null ptr          |function returning null ptr
   Target Milestone|4.1.0                       |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] [4.0 only] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (13 preceding siblings ...)
  2005-07-06 22:35 ` [Bug c++/20746] [4.0 only] " giovannibajo at libero dot it
@ 2005-07-12 11:30 ` cvs-commit at gcc dot gnu dot org
  2005-07-12 11:31 ` nathan at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-12 11:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-12 11:29 -------
Subject: Bug 20746

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	nathan@gcc.gnu.org	2005-07-12 11:28:03

Modified files:
	gcc/cp         : ChangeLog class.c cp-tree.def cp-tree.h decl.c 
	                 decl2.c error.c method.c parser.c pt.c 
	                 semantics.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/overload: error1.C 
	gcc/testsuite/g++.dg/parse: crash11.C 
	gcc/testsuite/g++.old-deja/g++.benjamin: warn02.C 
	gcc/testsuite/g++.old-deja/g++.brendan: arm2.C 
	gcc/testsuite/g++.old-deja/g++.other: redecl2.C redecl4.C 
	gcc/testsuite/g++.old-deja/g++.pt: memtemp78.C 
Added files:
	gcc/testsuite/g++.dg/abi: covariant5.C 
	gcc/testsuite/g++.dg/init: member1.C 
	gcc/testsuite/g++.dg/other: crash-4.C 
	gcc/testsuite/g++.dg/parse: crash26.C defarg9.C 

Log message:
	cp:
	PR c++/20678
	* error.c (dump_expr) <COMPONENT_REF case>: Check DECL_NAME is not
	null.
	
	PR 21903
	* cp-tree.def (DEFAULT_ARG): Document TREE_CHAIN use.
	* parser.c (cp_parser_late_parsing_default_args): Propagate parsed
	argument to any early instantiations.
	* pt.c (tsubst_arg_types): Chain early instantiation of default
	arg.
	
	PR c++/20789
	* decl.c (cp_finish_decl): Clear runtime runtime initialization if
	in-class decl's initializer is bad.
	
	PR c++/21929
	* parser.c (struct cp_parser): Document that scope could be
	error_mark.
	(cp_parser_diagnose_invalid_type_name): Cope with error_mark for
	scope.
	(cp_parser_nested_name_specifier): Return NULL_TREE on error.
	(cp_parser_postfix_expression): Deal with null or error_mark
	scope.
	(cp_parser_elaborated_type_specifier): Adjust
	cp_parser_nested_name_specifier call.
	
	PR c++/20746
	* method.c (use_thunk): Protect covariant pointer return
	adjustments from NULL pointers.
	testsuite:
	PR c++/20678
	* g++.dg/other/crash-4.C: New.
	
	PR 21903
	* g++.dg/parse/defarg9.C: New.
	
	PR c++/21929
	* g++.dg/parse/crash26.C: New.
	
	PR c++/20789
	* g++.dg/init/member1.C: New.
	
	PR c++/20746
	* g++.dg/abi/covariant5.C: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.63&r2=1.4648.2.64
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.707.2.3&r2=1.707.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.def.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.94.4.2&r2=1.94.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1106.2.8&r2=1.1106.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1371.2.14&r2=1.1371.2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.770.2.2&r2=1.770.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.279.2.1&r2=1.279.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.322.4.4&r2=1.322.4.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.319.2.10&r2=1.319.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.978.2.12&r2=1.978.2.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.463.2.4&r2=1.463.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.268&r2=1.5084.2.269
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/abi/covariant5.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/init/member1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/crash-4.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/error1.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2&r2=1.2.112.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash26.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/defarg9.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/crash11.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4&r2=1.4.28.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4&r2=1.4.76.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.76.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/redecl2.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.76.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/redecl4.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2&r2=1.2.76.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3&r2=1.3.76.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Bug c++/20746] [4.0 only] Incorrect return value for covariant return function returning null ptr
  2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
                   ` (14 preceding siblings ...)
  2005-07-12 11:30 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-12 11:31 ` nathan at gcc dot gnu dot org
  15 siblings, 0 replies; 17+ messages in thread
From: nathan at gcc dot gnu dot org @ 2005-07-12 11:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2005-07-12 11:29 -------
fixed on 4.0 branch

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20746


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2005-07-12 11:31 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-04 14:25 [Bug c++/20746] New: Incorrect return value for covariant return function returning null ptr yanliu at ca dot ibm dot com
2005-04-04 14:26 ` [Bug c++/20746] " pinskia at gcc dot gnu dot org
2005-04-04 14:35 ` pinskia at gcc dot gnu dot org
2005-04-04 14:39 ` pinskia at gcc dot gnu dot org
2005-04-04 14:43 ` nathan at gcc dot gnu dot org
2005-04-04 17:24 ` nathan at gcc dot gnu dot org
2005-04-04 17:37 ` yanliu at ca dot ibm dot com
2005-04-04 17:37 ` pinskia at gcc dot gnu dot org
2005-04-04 17:45 ` cvs-commit at gcc dot gnu dot org
2005-04-22  5:11 ` pinskia at gcc dot gnu dot org
2005-06-30 21:00 ` scp at predict dot com
2005-07-01 11:39 ` nathan at gcc dot gnu dot org
2005-07-05 15:40 ` mmitchel at gcc dot gnu dot org
2005-07-06 21:47 ` scp at predict dot com
2005-07-06 22:35 ` [Bug c++/20746] [4.0 only] " giovannibajo at libero dot it
2005-07-12 11:30 ` cvs-commit at gcc dot gnu dot org
2005-07-12 11:31 ` nathan at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).