public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions.
@ 2003-07-14 10:42 gdr at gcc dot gnu dot org
  2003-07-14 10:44 ` [Bug c++/11517] " gdr at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2003-07-14 10:42 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: g++ fails to properly convert pointer expressions in
                    conditional expressions.
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gdr at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,mark at codesourcery dot
                    com
 GCC build triplet: native
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: native

GCC-3.3.1 (prerelease as of 2003-07-14) fails to properly convert
pointer expressions in conditional expression.  This is a
regression.  Try to compile the program snippet attached to 
this report.


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

* [Bug c++/11517] g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
@ 2003-07-14 10:44 ` gdr at gcc dot gnu dot org
  2003-07-14 11:23 ` [Bug c++/11517] [3.3/3.4 Regression]g++ " pinskia at physics dot uc dot edu
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at gcc dot gnu dot org @ 2003-07-14 10:44 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at gcc dot gnu dot org  2003-07-14 10:44 -------
Created an attachment (id=4401)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4401&action=view)
this file contains a snipped of the rejected program


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

* [Bug c++/11517] [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
  2003-07-14 10:44 ` [Bug c++/11517] " gdr at gcc dot gnu dot org
@ 2003-07-14 11:23 ` pinskia at physics dot uc dot edu
  2003-07-14 11:31 ` pinskia at physics dot uc dot edu
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-14 11:23 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
 GCC target triplet|native                      |*-*-*
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-14 11:23:55
               date|                            |
            Summary|g++ fails to properly       |[3.3/3.4 Regression]g++
                   |convert pointer expressions |fails to properly convert
                   |in conditional expressions. |pointer expressions in
                   |                            |conditional expressions.


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-14 11:23 -------
Here is a reduced sources:
struct Term { };
struct Boolean : Term {
   explicit Boolean(bool);
};
struct IsZero : Term {
   Term *eval();
};
Term*
IsZero::eval()
{
   return true ? new Boolean(false) : this;
}

I can confirm this fails on the mainline (20030714), 3.3.1 (20030707), 3.2.3, 3.0.4 but it does not 
fail on 2.95.3 making this a regression.


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

* [Bug c++/11517] [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
  2003-07-14 10:44 ` [Bug c++/11517] " gdr at gcc dot gnu dot org
  2003-07-14 11:23 ` [Bug c++/11517] [3.3/3.4 Regression]g++ " pinskia at physics dot uc dot edu
@ 2003-07-14 11:31 ` pinskia at physics dot uc dot edu
  2003-07-14 12:22 ` gdr at integrable-solutions dot net
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-14 11:31 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |3.3.1


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

* [Bug c++/11517] [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-07-14 11:31 ` pinskia at physics dot uc dot edu
@ 2003-07-14 12:22 ` gdr at integrable-solutions dot net
  2003-07-14 15:09 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-07-14 12:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-07-14 12:22 -------
Subject: Re:  [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.

"pinskia at physics dot uc dot edu" <gcc-bugzilla@gcc.gnu.org> writes:
| Here is a reduced sources:
| struct Term { };
| struct Boolean : Term {
|    explicit Boolean(bool);
| };
| struct IsZero : Term {
|    Term *eval();
| };
| Term*
| IsZero::eval()
| {
|    return true ? new Boolean(false) : this;
| }

Funny, I tried that reduced testcase first, but somehow it didn't
display the regression, hence the slightly bigger testcase.

Thanks,

-- Gaby


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

* [Bug c++/11517] [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-07-14 12:22 ` gdr at integrable-solutions dot net
@ 2003-07-14 15:09 ` bangerth at dealii dot org
  2003-07-14 15:42 ` gdr at integrable-solutions dot net
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2003-07-14 15:09 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


------- Additional Comments From bangerth at dealii dot org  2003-07-14 15:09 -------
I am not at all sure that the code is legal, and even less that it is
a regression. The standard says that the two operands shall have the same
type, or that one should be convertible to the other one. This is not
the case here, where both would have to be converted to pointer-to-base.

FWIW, icc doesn't accept the code either. Gaby, would you mind
explaining on which part of 5.16 you base your opinion?

W.


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

* [Bug c++/11517] [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-07-14 15:09 ` bangerth at dealii dot org
@ 2003-07-14 15:42 ` gdr at integrable-solutions dot net
  2003-07-14 15:51 ` neroden at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-07-14 15:42 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-07-14 15:42 -------
Subject: Re:  [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| I am not at all sure that the code is legal, and even less that it is
| a regression. The standard says that the two operands shall have the same
| type, or that one should be convertible to the other one. This is not
| the case here, where both would have to be converted to pointer-to-base.
| 
| FWIW, icc doesn't accept the code either. Gaby, would you mind
| explaining on which part of 5.16 you base your opinion?

It is quite simple: I was presented with different behaviour of
GCC-2.95.x and GCC-3.3.1 on something which intuitively appeared clear
to me.  I was under the impression that "composite pointer type" can
also brings to common base class.  It appears not.  Sorry for the
confusion. 

-- Gaby


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

* [Bug c++/11517] [3.3/3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2003-07-14 15:42 ` gdr at integrable-solutions dot net
@ 2003-07-14 15:51 ` neroden at gcc dot gnu dot org
  2003-07-23 14:39 ` [Bug c++/11517] [3.4 " pinskia at physics dot uc dot edu
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: neroden at gcc dot gnu dot org @ 2003-07-14 15:51 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


neroden at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From neroden at gcc dot gnu dot org  2003-07-14 15:51 -------
According to comments, this is in fact invalid code, and it gives a nice error message.


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

* [Bug c++/11517] [3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2003-07-14 15:51 ` neroden at gcc dot gnu dot org
@ 2003-07-23 14:39 ` pinskia at physics dot uc dot edu
  2003-07-23 15:37 ` pinskia at physics dot uc dot edu
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-23 14:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
           Keywords|rejects-valid               |error-recovery, ice-on-
                   |                            |invalid-code
         Resolution|INVALID                     |
            Summary|[3.3/3.4 Regression]g++     |[3.4 Regression]g++ fails to
                   |fails to properly convert   |properly convert pointer
                   |pointer expressions in      |expressions in conditional
                   |conditional expressions.    |expressions.
   Target Milestone|3.3.1                       |3.4
            Version|3.3.1                       |3.4


------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-23 14:39 -------
This now ICE's on the mainline (20030723) so making this a regression.  It did not ICE 
yesterday:

/Users/pinskia/src/gccPRs/testcases/pr11517.cc:11: error: conditional 
   expression between distinct pointer types `Boolean*' and `IsZero*' lacks a 
   cast
/Users/pinskia/src/gccPRs/testcases/pr11517.cc:11: error: could not convert `
   (operator new(long unsigned int)(1), ((true, 
   (<anonymous>->Boolean::Boolean(bool)(false), (<anonymous> <unknown operator> 
   false))), <anonymous>))' to `<type error>'
/Users/pinskia/src/gccPRs/testcases/pr11517.cc:11: error: could not convert `
   this' to `<type error>'
/Users/pinskia/src/gccPRs/testcases/pr11517.cc:11: internal compiler error: tree
   check: expected class 't', have 'x' (error_mark) in build_conditional_expr, 
   at cp/call.c:3354
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


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

* [Bug c++/11517] [3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2003-07-23 14:39 ` [Bug c++/11517] [3.4 " pinskia at physics dot uc dot edu
@ 2003-07-23 15:37 ` pinskia at physics dot uc dot edu
  2003-07-23 18:44 ` cvs-commit at gcc dot gnu dot org
  2003-07-23 18:49 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-23 15:37 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |minor


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

* [Bug c++/11517] [3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2003-07-23 15:37 ` pinskia at physics dot uc dot edu
@ 2003-07-23 18:44 ` cvs-commit at gcc dot gnu dot org
  2003-07-23 18:49 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-07-23 18:44 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-07-23 18:44 -------
Subject: Bug 11517

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-07-23 18:44:43

Modified files:
	gcc/cp         : ChangeLog call.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/expr: cond2.C 

Log message:
	PR c++/11517
	* call.c (build_conditional_expr): Use perform_implicit_conversion
	and error_operand_p.  Robustify.
	* typeck.c (build_unary_op): Use perform_implicit_conversion.
	
	PR c++/11517
	* g++.dg/expr/cond2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3544&r2=1.3545
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/call.c.diff?cvsroot=gcc&r1=1.412&r2=1.413
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.484&r2=1.485
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2911&r2=1.2912
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/expr/cond2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug c++/11517] [3.4 Regression]g++ fails to properly convert pointer expressions in conditional expressions.
  2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2003-07-23 18:44 ` cvs-commit at gcc dot gnu dot org
@ 2003-07-23 18:49 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2003-07-23 18:49 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


mmitchel at gcc dot gnu dot org changed:

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


------- Additional Comments From mmitchel at gcc dot gnu dot org  2003-07-23 18:49 -------
Fixed in GCC 3.4.


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

end of thread, other threads:[~2003-07-23 18:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-14 10:42 [Bug c++/11517] New: g++ fails to properly convert pointer expressions in conditional expressions gdr at gcc dot gnu dot org
2003-07-14 10:44 ` [Bug c++/11517] " gdr at gcc dot gnu dot org
2003-07-14 11:23 ` [Bug c++/11517] [3.3/3.4 Regression]g++ " pinskia at physics dot uc dot edu
2003-07-14 11:31 ` pinskia at physics dot uc dot edu
2003-07-14 12:22 ` gdr at integrable-solutions dot net
2003-07-14 15:09 ` bangerth at dealii dot org
2003-07-14 15:42 ` gdr at integrable-solutions dot net
2003-07-14 15:51 ` neroden at gcc dot gnu dot org
2003-07-23 14:39 ` [Bug c++/11517] [3.4 " pinskia at physics dot uc dot edu
2003-07-23 15:37 ` pinskia at physics dot uc dot edu
2003-07-23 18:44 ` cvs-commit at gcc dot gnu dot org
2003-07-23 18:49 ` mmitchel 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).