public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union
@ 2004-01-30  6:23 mec dot gnu at mindspring dot com
  2004-01-30 12:22 ` [Bug c++/13927] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mec dot gnu at mindspring dot com @ 2004-01-30  6:23 UTC (permalink / raw)
  To: gcc-bugs

Consider this ill-formed program:

  int main ()
  {
    union { int alpha; int beta; };
    double alpha;
    return 0;
  }

This is bad because "alpha" is declared twice.

gcc HEAD says:

/berman/fsf/_today_/berman/install/target/native/gcc/gcc-HEAD-as-2.14-ld-2.14/bin/g++
-S au-3.cc
  au-3.cc: In function `int main()':
  au-3.cc:4: error: `double alpha' redeclared as different kind of symbol
  au-3.cc:3: error: previous declaration of `#`alias_decl' not supported by
dump_decl#<declaration error>'
  au-3.cc:4: error: declaration of `double alpha'
  au-3.cc:3: error: conflicts with previous declaration `#`alias_decl' not
supported by dump_decl#<declaration error>'

This doesn't bother me because the line numbers do point to the right place so
that people can get work done.  But it might be nicer if gcc could print a
better error message.

That is, I wouldn't mind a WONTFIX on this one, if fixing it would make the
compiler less elegant.  But I suspect that there is code which doesn't know
about these strange types created by anon union variables so it might be good to
fix this.

For comparison, gcc 3.3.2 prints:

au-3.cc: In function `int main()':
au-3.cc:4: error: conflicting types for `double alpha'
au-3.cc:3: error: previous declaration as `int alpha'

-- 
           Summary: confusing error message on ibad redeclaration of anon
                    union
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec dot gnu at mindspring dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on ibad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
@ 2004-01-30 12:22 ` pinskia at gcc dot gnu dot org
  2004-02-02 19:23 ` [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad " giovannibajo at libero dot it
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-30 12:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-30 12:22 -------
Confirmed, a regression.  Looks like alias_decl needs to be supported by dump_decl.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-30 12:22:28
               date|                            |
            Summary|confusing error message on  |[3.4/3.5 Regression]
                   |ibad redeclaration of anon  |confusing error message on
                   |union                       |ibad redeclaration of anon
                   |                            |union
   Target Milestone|---                         |3.4.0


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
  2004-01-30 12:22 ` [Bug c++/13927] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-02-02 19:23 ` giovannibajo at libero dot it
  2004-02-02 20:43 ` giovannibajo at libero dot it
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-02 19:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-02 19:22 -------
Mine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |giovannibajo at libero dot
                   |dot org                     |it
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
  2004-01-30 12:22 ` [Bug c++/13927] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-02-02 19:23 ` [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad " giovannibajo at libero dot it
@ 2004-02-02 20:43 ` giovannibajo at libero dot it
  2004-02-14  2:12 ` cvs-commit at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-02 20:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-02 20:43 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00109.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (2 preceding siblings ...)
  2004-02-02 20:43 ` giovannibajo at libero dot it
@ 2004-02-14  2:12 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:15 ` cvs-commit at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-14  2:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-14 02:11 -------
Subject: Bug 13927

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	giovannibajo@gcc.gnu.org	2004-02-14 02:11:27

Modified files:
	gcc/cp         : ChangeLog error.c 

Log message:
	PR c++/13927
	* error.c (dump_decl) <ALIAS_DECL>: Dump as simple declarations.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3954&r2=1.3955
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.243&r2=1.244



-- 


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (3 preceding siblings ...)
  2004-02-14  2:12 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-14  2:15 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:17 ` cvs-commit at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-14  2:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-14 02:15 -------
Subject: Bug 13927

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	giovannibajo@gcc.gnu.org	2004-02-14 02:15:21

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/other: error8.C 

Log message:
	PR c++/13927
	* g++.dg/other/error8.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3497&r2=1.3498
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/error8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (4 preceding siblings ...)
  2004-02-14  2:15 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-14  2:17 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:19 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-14  2:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-14 02:17 -------
Subject: Bug 13927

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	giovannibajo@gcc.gnu.org	2004-02-14 02:17:38

Modified files:
	gcc/cp         : ChangeLog error.c 

Log message:
	PR c++/13927
	* error.c (dump_decl) <ALIAS_DECL>: Dump as simple declarations.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.49&r2=1.3892.2.50
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.241&r2=1.241.4.1



-- 


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


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

* [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (5 preceding siblings ...)
  2004-02-14  2:17 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-14  2:19 ` cvs-commit at gcc dot gnu dot org
  2004-02-14  2:23 ` [Bug c++/13927] [3.4/3.5 Regression] duplicated " giovannibajo at libero dot it
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-14  2:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-14 02:19 -------
Subject: Bug 13927

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	giovannibajo@gcc.gnu.org	2004-02-14 02:19:28

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/other: error8.C 

Log message:
	PR c++/13927
	* g++.dg/other/error8.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.73&r2=1.3389.2.74
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/error8.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/13927] [3.4/3.5 Regression] duplicated error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (6 preceding siblings ...)
  2004-02-14  2:19 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-14  2:23 ` giovannibajo at libero dot it
  2004-02-20  7:33 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-14  2:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-14 02:23 -------
I fixed the main regression, which was the unreadable error message. Now it 
says:

pr13927.cc:12: error: `double alpha' redeclared as different kind of symbol
pr13927.cc:11: error: previous declaration of `int alpha'
pr13927.cc:12: error: declaration of `double alpha'
pr13927.cc:11: error: conflicts with previous declaration `int alpha'

The duplicated error message problem was discussed on gcc-patches as a followup 
to my patch. Problem is, I don't fully understand that code, so I'm leaving 
this bug to someone else. I updated the summary to reflect the new status. 

The testcase (g++.dg/other/error8.C) already checks for the double diagnostic, 
and it's currently xfailed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|giovannibajo at libero dot  |unassigned at gcc dot gnu
                   |it                          |dot org
             Status|ASSIGNED                    |NEW
           Keywords|patch                       |
            Summary|[3.4/3.5 Regression]        |[3.4/3.5 Regression]
                   |confusing error message on  |duplicated error message on
                   |bad redeclaration of anon   |bad redeclaration of anon
                   |union                       |union


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


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

* [Bug c++/13927] [3.4/3.5 Regression] duplicated error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (7 preceding siblings ...)
  2004-02-14  2:23 ` [Bug c++/13927] [3.4/3.5 Regression] duplicated " giovannibajo at libero dot it
@ 2004-02-20  7:33 ` mmitchel at gcc dot gnu dot org
  2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
  2004-02-20  8:58 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-20  7:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-20 07:33 -------
We'll not fix this for 3.4, or any 3.4.x release, because the fix might cause
breakage elsewhere and the regression is very minor.

I'll work on a fix for the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Target Milestone|3.4.0                       |3.5.0


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


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

* [Bug c++/13927] [3.4/3.5 Regression] duplicated error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (8 preceding siblings ...)
  2004-02-20  7:33 ` mmitchel at gcc dot gnu dot org
@ 2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
  2004-02-20  8:58 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-02-20  8:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-02-20 08:57 -------
Subject: Bug 13927

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-02-20 08:57:33

Modified files:
	gcc/cp         : ChangeLog decl.c name-lookup.c pt.c semantics.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/other: error8.C 
Added files:
	gcc/testsuite/g++.dg/ext: packed5.C 
	gcc/testsuite/g++.dg/warn: Wunused-5.C 

Log message:
	PR c++/14199
	* pt.c (tsubst_copy): Call mark_used for a PARM_DECL.
	
	PR c++/14173
	* semantics.c (begin_class_definition): Set TYPE_PACKED correctly
	for all type variants.
	
	PR c++/14173
	* g++.dg/ext/packed5.C: New test.
	
	PR c++/14199
	* g++.dg/warn/Wunused-5.C: New test.
	
	PR c++/13927
	* decl.c (duplicate_decls): Return error_mark_node for invalid
	redeclarations.
	* name-lookup.c (push_namespace): Ignore the return value from
	pushdecl.
	* pt.c (push_template_decl_real): Robustify.
	
	PR c++/13927
	* g++.dg/other/error8.C: Remove XFAIL markers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3962&r2=1.3963
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1187&r2=1.1188
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.39&r2=1.40
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.830&r2=1.831
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.388&r2=1.389
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3523&r2=1.3524
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/packed5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/other/error8.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/warn/Wunused-5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/13927] [3.4/3.5 Regression] duplicated error message on bad redeclaration of anon union
  2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
                   ` (9 preceding siblings ...)
  2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
@ 2004-02-20  8:58 ` mmitchel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-02-20  8:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-02-20 08:58 -------
Fixed in GCC 3.5.

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


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


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

end of thread, other threads:[~2004-02-20  8:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-30  6:23 [Bug c++/13927] New: confusing error message on ibad redeclaration of anon union mec dot gnu at mindspring dot com
2004-01-30 12:22 ` [Bug c++/13927] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-02-02 19:23 ` [Bug c++/13927] [3.4/3.5 Regression] confusing error message on bad " giovannibajo at libero dot it
2004-02-02 20:43 ` giovannibajo at libero dot it
2004-02-14  2:12 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:15 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:17 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:19 ` cvs-commit at gcc dot gnu dot org
2004-02-14  2:23 ` [Bug c++/13927] [3.4/3.5 Regression] duplicated " giovannibajo at libero dot it
2004-02-20  7:33 ` mmitchel at gcc dot gnu dot org
2004-02-20  8:57 ` cvs-commit at gcc dot gnu dot org
2004-02-20  8:58 ` 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).