public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26269]  New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
@ 2006-02-13 22:56 reichelt at gcc dot gnu dot org
  2006-02-14  0:00 ` [Bug c++/26269] " pinskia at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-02-13 22:56 UTC (permalink / raw)
  To: gcc-bugs

Compiling the invalid code snippet

==================
void foo()
{
    i;
    int i;
}
==================

yields the following error message (since GCC 3.4.5):

bug.cc: In function 'void foo()':
bug.cc:3: error: 'i' was not declared in this scope
bug.cc:4: error: redeclaration of 'int i'
bug.cc:3: error: '<typeprefixerror>i' previously declared here

The error about the redeclaraion is bogus here.
It is issued because we created a dummy declaration of 'i' to
suppress further error messages about 'i' being not declared.

Since the dummy declaration contains an error_mark_node as TREE_TYPE
(which btw. causes the <typeprefixerror> part) we should be able to
detect this case and skip issuing the redeclaration error message.
In fact we do attempt something like this in duplicate_decls:

  /* If either the type of the new decl or the type of the old decl is an
     error_mark_node, then that implies that we have already issued an
     error (earlier) for some bogus type specification, and in that case,
     it is rather pointless to harass the user with yet more error message
     about the same declaration, so just pretend the types match here.  */
  if (TREE_TYPE (newdecl) == error_mark_node
      || TREE_TYPE (olddecl) == error_mark_node)
    types_match = 1;

We indeed have TREE_TYPE (olddecl) == error_mark_node in the testcase
above, but apparently just setting types_match = 1 is not enough.

Is it possible to get rid of olddecl altogether and replace it with
newdecl?


-- 
           Summary: [3.4/4.0/4.1/4.2 regression] Declaring a variable too
                    late yields bogus error message
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/26269] [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
@ 2006-02-14  0:00 ` pinskia at gcc dot gnu dot org
  2006-02-14  9:08 ` mmitchel at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-14  0:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-02-14 00:00 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-14 00:00:24
               date|                            |
   Target Milestone|---                         |4.0.3


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


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

* [Bug c++/26269] [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
  2006-02-14  0:00 ` [Bug c++/26269] " pinskia at gcc dot gnu dot org
@ 2006-02-14  9:08 ` mmitchel at gcc dot gnu dot org
  2006-02-14  9:09 ` mmitchel at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-14  9:08 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/26269] [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
  2006-02-14  0:00 ` [Bug c++/26269] " pinskia at gcc dot gnu dot org
  2006-02-14  9:08 ` mmitchel at gcc dot gnu dot org
@ 2006-02-14  9:09 ` mmitchel at gcc dot gnu dot org
  2006-02-14 10:04 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-14  9:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug c++/26269] [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-02-14  9:09 ` mmitchel at gcc dot gnu dot org
@ 2006-02-14 10:04 ` rguenth at gcc dot gnu dot org
  2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-14 10:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2006-02-14 10:04 -------
I guess I was assigned this bug by accident.  Unassigning.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rguenth at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug c++/26269] [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-02-14 10:04 ` rguenth at gcc dot gnu dot org
@ 2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
  2006-05-25  2:43 ` [Bug c++/26269] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-24  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2006-02-24 00:27 -------
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.3                       |4.1.1


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


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

* [Bug c++/26269] [4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
@ 2006-05-25  2:43 ` mmitchel at gcc dot gnu dot org
  2006-08-19 19:10 ` lmillward at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-25  2:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mmitchel at gcc dot gnu dot org  2006-05-25 02:34 -------
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.1                       |4.1.2


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


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

* [Bug c++/26269] [4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-05-25  2:43 ` [Bug c++/26269] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
@ 2006-08-19 19:10 ` lmillward at gcc dot gnu dot org
  2006-08-20  7:33 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: lmillward at gcc dot gnu dot org @ 2006-08-19 19:10 UTC (permalink / raw)
  To: gcc-bugs



-- 

lmillward at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lmillward at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-07-05 09:54:56         |2006-08-19 19:09:56
               date|                            |


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


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

* [Bug c++/26269] [4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-08-19 19:10 ` lmillward at gcc dot gnu dot org
@ 2006-08-20  7:33 ` patchapp at dberlin dot org
  2006-08-21 17:28 ` [Bug c++/26269] [4.0/4.1 " lmillward at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: patchapp at dberlin dot org @ 2006-08-20  7:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from patchapp at dberlin dot org  2006-08-20 07:33 -------
Subject: Bug number PR c++/26269

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-08/msg00710.html


-- 


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


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

* [Bug c++/26269] [4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-08-21 17:28 ` [Bug c++/26269] [4.0/4.1 " lmillward at gcc dot gnu dot org
@ 2006-08-21 17:28 ` lmillward at gcc dot gnu dot org
  2007-02-14  9:09 ` [Bug c++/26269] [4.0/4.1 " mmitchel at gcc dot gnu dot org
  2008-07-04 15:17 ` [Bug c++/26269] [4.1 " jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: lmillward at gcc dot gnu dot org @ 2006-08-21 17:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from lmillward at gcc dot gnu dot org  2006-08-21 17:27 -------
Subject: Bug 26269

Author: lmillward
Date: Mon Aug 21 17:27:48 2006
New Revision: 116301

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116301
Log:
        PR c++/26269
        * decl.c (duplicate_decls): Return early if either
        newdecl or olddecl is error_mark_node.

        * g++.dg/other/error14.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/other/error14.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/26269] [4.0/4.1 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-08-20  7:33 ` patchapp at dberlin dot org
@ 2006-08-21 17:28 ` lmillward at gcc dot gnu dot org
  2006-08-21 17:28 ` [Bug c++/26269] [4.0/4.1/4.2 " lmillward at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: lmillward at gcc dot gnu dot org @ 2006-08-21 17:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from lmillward at gcc dot gnu dot org  2006-08-21 17:28 -------
Fixed on mainline.


-- 

lmillward at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1/4.2 regression]    |[4.0/4.1 regression]
                   |Declaring a variable too    |Declaring a variable too
                   |late yields bogus error     |late yields bogus error
                   |message                     |message


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


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

* [Bug c++/26269] [4.0/4.1 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2006-08-21 17:28 ` [Bug c++/26269] [4.0/4.1/4.2 " lmillward at gcc dot gnu dot org
@ 2007-02-14  9:09 ` mmitchel at gcc dot gnu dot org
  2008-07-04 15:17 ` [Bug c++/26269] [4.1 " jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug c++/26269] [4.1 regression] Declaring a variable too late yields bogus error message
  2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2007-02-14  9:09 ` [Bug c++/26269] [4.0/4.1 " mmitchel at gcc dot gnu dot org
@ 2008-07-04 15:17 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2008-07-04 15:16 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|4.0.4                       |4.0.4 4.1.3
      Known to work|3.3.6                       |3.3.6 4.2.0
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.0


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


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

end of thread, other threads:[~2008-07-04 15:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-13 22:56 [Bug c++/26269] New: [3.4/4.0/4.1/4.2 regression] Declaring a variable too late yields bogus error message reichelt at gcc dot gnu dot org
2006-02-14  0:00 ` [Bug c++/26269] " pinskia at gcc dot gnu dot org
2006-02-14  9:08 ` mmitchel at gcc dot gnu dot org
2006-02-14  9:09 ` mmitchel at gcc dot gnu dot org
2006-02-14 10:04 ` rguenth at gcc dot gnu dot org
2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
2006-05-25  2:43 ` [Bug c++/26269] [4.0/4.1/4.2 " mmitchel at gcc dot gnu dot org
2006-08-19 19:10 ` lmillward at gcc dot gnu dot org
2006-08-20  7:33 ` patchapp at dberlin dot org
2006-08-21 17:28 ` [Bug c++/26269] [4.0/4.1 " lmillward at gcc dot gnu dot org
2006-08-21 17:28 ` [Bug c++/26269] [4.0/4.1/4.2 " lmillward at gcc dot gnu dot org
2007-02-14  9:09 ` [Bug c++/26269] [4.0/4.1 " mmitchel at gcc dot gnu dot org
2008-07-04 15:17 ` [Bug c++/26269] [4.1 " jsm28 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).