public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21930] New: [4.1 regression] pretty printer confusion
@ 2005-06-06 14:32 reichelt at gcc dot gnu dot org
  2005-06-06 14:37 ` [Bug c++/21930] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-06-06 14:32 UTC (permalink / raw)
  To: gcc-bugs

On mainline I get a hosed error message for the following invalid code
snippet:

========================================================
template<int> struct A {};

template<int N> void foo(const A<N> &a) { -A<N>(a); }

void bar()
{
    foo(A<0>());
}
========================================================

The error message reads:

  bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
  bug.cc:7:   instantiated from here
  bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)#'convert_expr'
not supported by dump_expr#<expression error>)'

With gcc 4.0.0 I get the following message instead:

  bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
  bug.cc:7:   instantiated from here
  bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)(+ a))'

I don't know why the plus sign appears before "a", but this suggests that
the regression is related to the recent introduction of UNARY_PLUS_EXPR:
http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02580.html

-- 
           Summary: [4.1 regression] pretty printer confusion
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,giovannibajo at gcc dot
                    gnu dot org,roger at eyesopen dot com


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


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

* [Bug c++/21930] [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
@ 2005-06-06 14:37 ` pinskia at gcc dot gnu dot org
  2005-06-06 14:47 ` giovannibajo at libero dot it
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-06 14:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-06 14:37 -------
Confirmed, 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-06 14:37:10
               date|                            |
   Target Milestone|---                         |4.1.0


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


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

* [Bug c++/21930] [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
  2005-06-06 14:37 ` [Bug c++/21930] " pinskia at gcc dot gnu dot org
@ 2005-06-06 14:47 ` giovannibajo at libero dot it
  2005-06-06 14:50 ` gdr at integrable-solutions dot net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2005-06-06 14:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-06-06 14:47 -------
Ot looks like dump_expr must support CONVERT_EXPRs, and just strip them. 
Before, there was no way to discern between unary plus and a real conversion, 
but now they are different codes. Not all occurrences of CONVERT_EXPRs in 
dump_expr where unary pluses, even if we were treating them so.

-- 


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


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

* [Bug c++/21930] [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
  2005-06-06 14:37 ` [Bug c++/21930] " pinskia at gcc dot gnu dot org
  2005-06-06 14:47 ` giovannibajo at libero dot it
@ 2005-06-06 14:50 ` gdr at integrable-solutions dot net
  2005-06-06 14:50 ` [Bug c++/21930] New: " Gabriel Dos Reis
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-06-06 14:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2005-06-06 14:50 -------
Subject: Re:  New: [4.1 regression] pretty printer confusion

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

| The error message reads:
| 
|   bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
|   bug.cc:7:   instantiated from here
|   bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)#'convert_expr'
| not supported by dump_expr#<expression error>)'
| 
| With gcc 4.0.0 I get the following message instead:
| 
|   bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
|   bug.cc:7:   instantiated from here
|   bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)(+ a))'
| 
| I don't know why the plus sign appears before "a", 

The plus sign is a bogosity in the tree representation, not correctly
understaood by the pretty-printer, which cannot differentiate between
conversion from reference to pointer, lvalue->rvalue conversion and
real unary plus. They usually appear under the cover of CONVERT_EXPR.

| but this suggests that
| the regression is related to the recent introduction of UNARY_PLUS_EXPR:
| http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02580.html

Indeed.

-- Gaby


-- 


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


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

* Re: [Bug c++/21930] New: [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-06-06 14:50 ` gdr at integrable-solutions dot net
@ 2005-06-06 14:50 ` Gabriel Dos Reis
  2005-06-12 21:34 ` [Bug c++/21930] " reichelt at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Gabriel Dos Reis @ 2005-06-06 14:50 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

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

| The error message reads:
| 
|   bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
|   bug.cc:7:   instantiated from here
|   bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)#'convert_expr'
| not supported by dump_expr#<expression error>)'
| 
| With gcc 4.0.0 I get the following message instead:
| 
|   bug.cc: In function 'void foo(const A<N>&) [with int N = 0]':
|   bug.cc:7:   instantiated from here
|   bug.cc:3: error: no match for 'operator-' in '-((const A<0>&)(+ a))'
| 
| I don't know why the plus sign appears before "a", 

The plus sign is a bogosity in the tree representation, not correctly
understaood by the pretty-printer, which cannot differentiate between
conversion from reference to pointer, lvalue->rvalue conversion and
real unary plus. They usually appear under the cover of CONVERT_EXPR.

| but this suggests that
| the regression is related to the recent introduction of UNARY_PLUS_EXPR:
| http://gcc.gnu.org/ml/gcc-patches/2005-05/msg02580.html

Indeed.

-- Gaby


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

* [Bug c++/21930] [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-06-06 14:50 ` [Bug c++/21930] New: " Gabriel Dos Reis
@ 2005-06-12 21:34 ` reichelt at gcc dot gnu dot org
  2005-06-12 23:46 ` cvs-commit at gcc dot gnu dot org
  2005-06-13  0:41 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-06-12 21:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|roger at eyesopen dot com   |
         AssignedTo|unassigned at gcc dot gnu   |roger at eyesopen dot com
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |06/msg01073.html
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch


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


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

* [Bug c++/21930] [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-06-12 21:34 ` [Bug c++/21930] " reichelt at gcc dot gnu dot org
@ 2005-06-12 23:46 ` cvs-commit at gcc dot gnu dot org
  2005-06-13  0:41 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-12 23:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-12 23:46 -------
Subject: Bug 21930

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2005-06-12 23:46:46

Modified files:
	gcc/cp         : ChangeLog error.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/other: error10.C 

Log message:
	PR c++/21930
	* error.c (dump_expr): UNARY_PLUS_EXPR need not handle void types.
	Treat CONVERT_EXPR identically to NOP_EXPR.
	
	* g++.dg/other/error10.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4784&r2=1.4785
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.282&r2=1.283
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5627&r2=1.5628
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/error10.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/21930] [4.1 regression] pretty printer confusion
  2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-06-12 23:46 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-13  0:41 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-13  0:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-13 00:41 -------
Fixed.

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


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


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

end of thread, other threads:[~2005-06-13  0:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-06 14:32 [Bug c++/21930] New: [4.1 regression] pretty printer confusion reichelt at gcc dot gnu dot org
2005-06-06 14:37 ` [Bug c++/21930] " pinskia at gcc dot gnu dot org
2005-06-06 14:47 ` giovannibajo at libero dot it
2005-06-06 14:50 ` gdr at integrable-solutions dot net
2005-06-06 14:50 ` [Bug c++/21930] New: " Gabriel Dos Reis
2005-06-12 21:34 ` [Bug c++/21930] " reichelt at gcc dot gnu dot org
2005-06-12 23:46 ` cvs-commit at gcc dot gnu dot org
2005-06-13  0:41 ` pinskia 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).