public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21899] New: enum definition accepts values to be overriden
@ 2005-06-03 14:04 g dot bloisi at iontrading dot com
  2005-06-03 14:10 ` [Bug c/21899] [3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: g dot bloisi at iontrading dot com @ 2005-06-03 14:04 UTC (permalink / raw)
  To: gcc-bugs

The code below with gcc compiles and the exe prints "Value: 3".
With g++, instead, the compilation fails with the following error:
main.c:7: error: redefinition of `A'
main.c:4: error: `A' previously defined here

Regards,
Giambattista Bloisi

----
#include <stdio.h>

typedef enum {
        A = 1,
        B = 2,
        A
} myenum;

int main() {
        myenum a = A;

        printf("Value: %d\n", (int)a);
return 0;
}

-- 
           Summary: enum definition accepts values to be overriden
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: g dot bloisi at iontrading dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/21899] [3.4 Regression] enum definition accepts values to be overriden
  2005-06-03 14:04 [Bug c/21899] New: enum definition accepts values to be overriden g dot bloisi at iontrading dot com
@ 2005-06-03 14:10 ` pinskia at gcc dot gnu dot org
  2005-06-03 16:03 ` joseph at codesourcery dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-03 14:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-03 14:10 -------
Confirmed, only a 3.4 regression.
Started to work on the mainline:
: Search converges between 2004-09-24-014001-trunk (#558) and 2004-09-24-161002-trunk 
(#559).

Started to fail:
: Search converges between 2004-01-01-trunk (#437) and 2004-01-17-trunk (#438).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.4.0
      Known to work|                            |3.3.3 4.0.0 4.1.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-03 14:10:08
               date|                            |
            Summary|enum definition accepts     |[3.4 Regression] enum
                   |values to be overriden      |definition accepts values to
                   |                            |be overriden
   Target Milestone|---                         |3.4.5


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


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

* [Bug c/21899] [3.4 Regression] enum definition accepts values to be overriden
  2005-06-03 14:04 [Bug c/21899] New: enum definition accepts values to be overriden g dot bloisi at iontrading dot com
  2005-06-03 14:10 ` [Bug c/21899] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2005-06-03 16:03 ` joseph at codesourcery dot com
  2005-07-28 23:08 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2005-06-03 16:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joseph at codesourcery dot com  2005-06-03 16:03 -------
Subject: Re:  [3.4 Regression] enum definition accepts values
 to be overriden

On Fri, 3 Jun 2005, pinskia at gcc dot gnu dot org wrote:

> Confirmed, only a 3.4 regression.
> Started to work on the mainline:
> : Search converges between 2004-09-24-014001-trunk (#558) and 2004-09-24-161002-trunk 
> (#559).

I.e., fixed by my fix for bug 17188 
<http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02566.html>.  This patch is 
probably safe to backport to 3.4 branch.



-- 


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


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

* [Bug c/21899] [3.4 Regression] enum definition accepts values to be overriden
  2005-06-03 14:04 [Bug c/21899] New: enum definition accepts values to be overriden g dot bloisi at iontrading dot com
  2005-06-03 14:10 ` [Bug c/21899] [3.4 Regression] " pinskia at gcc dot gnu dot org
  2005-06-03 16:03 ` joseph at codesourcery dot com
@ 2005-07-28 23:08 ` cvs-commit at gcc dot gnu dot org
  2005-07-28 23:10 ` jsm28 at gcc dot gnu dot org
  2005-08-26 17:42 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-28 23:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-28 23:02 -------
Subject: Bug 21899

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	jsm28@gcc.gnu.org	2005-07-28 23:01:31

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: decl-3.c 
Added files:
	gcc/testsuite/gcc.dg: nested-redef-1.c pr17188-1.c 

Log message:
	PR c/17188
	PR c/21899
	* c-decl.c (diagnose_mismatched_decls): Check for duplicate
	declarations of enumerators.
	(start_struct): Check TYPE_SIZE rather than TYPE_FIELDS to check
	for redefinition.  Check for nested redefinition.
	(finish_struct): Don't check for nested redefinition.
	(start_enum): Check for nested redefinition.
	
	testsuite:
	* gcc.dg/nested-redef-1.c, gcc.dg/pr17188-1.c: New tests.
	* gcc.dg/decl-3.c: Adjust expected message.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.889&r2=2.2326.2.890
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.20&r2=1.470.4.21
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.414&r2=1.3389.2.415
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/nested-redef-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.60.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr17188-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.60.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-3.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2&r2=1.2.4.1



-- 


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


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

* [Bug c/21899] [3.4 Regression] enum definition accepts values to be overriden
  2005-06-03 14:04 [Bug c/21899] New: enum definition accepts values to be overriden g dot bloisi at iontrading dot com
                   ` (2 preceding siblings ...)
  2005-07-28 23:08 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-28 23:10 ` jsm28 at gcc dot gnu dot org
  2005-08-26 17:42 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-07-28 23:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-07-28 23:09 -------
Fixed on 3.4 branch by backporting patch.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c/21899] [3.4 Regression] enum definition accepts values to be overriden
  2005-06-03 14:04 [Bug c/21899] New: enum definition accepts values to be overriden g dot bloisi at iontrading dot com
                   ` (3 preceding siblings ...)
  2005-07-28 23:10 ` jsm28 at gcc dot gnu dot org
@ 2005-08-26 17:42 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-26 17:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-26 17:40 -------
*** Bug 23580 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |castor at 3pardata dot com


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


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

end of thread, other threads:[~2005-08-26 17:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-03 14:04 [Bug c/21899] New: enum definition accepts values to be overriden g dot bloisi at iontrading dot com
2005-06-03 14:10 ` [Bug c/21899] [3.4 Regression] " pinskia at gcc dot gnu dot org
2005-06-03 16:03 ` joseph at codesourcery dot com
2005-07-28 23:08 ` cvs-commit at gcc dot gnu dot org
2005-07-28 23:10 ` jsm28 at gcc dot gnu dot org
2005-08-26 17:42 ` 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).