public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16372] New: Wrong code for enums
@ 2004-07-05 18:56 schuele at informatik dot uni-kl dot de
  2004-07-05 19:03 ` [Bug c++/16372] " schuele at informatik dot uni-kl dot de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: schuele at informatik dot uni-kl dot de @ 2004-07-05 18:56 UTC (permalink / raw)
  To: gcc-bugs

Hi, 
 
there still seems to be a problem with enums in GCC 3.4.1 (see bug #15069). 
When you compile the follwing snippet with -O0, everthing works well. However, 
with -O1, the output is "234" which is wrong. Sorry, if this is a duplicate 
bug report, but I assumed it would be fixed in GCC 3.4.1. Thanks for your 
help. 
 
Regards, 
Tobias 
 
 
#include <iostream> 
 
enum number {ZERO, ONE, TWO, THREE, FOUR, FIVE}; 
 
int main() { 
  number n = FIVE; 
 
  if((n == ONE) || (n == TWO) || (n == THREE)) { 
    std::cout << "234" << std::endl; 
  } 
}

-- 
           Summary: Wrong code for enums
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schuele at informatik dot uni-kl dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug c++/16372] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
@ 2004-07-05 19:03 ` schuele at informatik dot uni-kl dot de
  2004-07-05 21:16 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: schuele at informatik dot uni-kl dot de @ 2004-07-05 19:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schuele at informatik dot uni-kl dot de  2004-07-05 19:03 -------
Of course, the output should be "123", but that doesn't make a difference... 

-- 


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


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

* [Bug c++/16372] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
  2004-07-05 19:03 ` [Bug c++/16372] " schuele at informatik dot uni-kl dot de
@ 2004-07-05 21:16 ` pinskia at gcc dot gnu dot org
  2004-07-10 18:24 ` [Bug tree-optimization/16372] [3.4/3.5 Regression] " cvs-commit at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-05 21:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-05 21:16 -------
Confirmed, I must have closed one bug as a dup of that bug thinking they were the same problem when 
in fact this comes from the shorting part of fold.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-05 21:16:17
               date|                            |
   Target Milestone|---                         |3.4.2


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


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

* [Bug tree-optimization/16372] [3.4/3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
  2004-07-05 19:03 ` [Bug c++/16372] " schuele at informatik dot uni-kl dot de
  2004-07-05 21:16 ` pinskia at gcc dot gnu dot org
@ 2004-07-10 18:24 ` cvs-commit at gcc dot gnu dot org
  2004-07-12  5:41 ` [Bug tree-optimization/16372] [3.5 " pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-10 18:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-07-10 18:24 -------
Subject: Bug 16372

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	jakub@gcc.gnu.org	2004-07-10 18:23:58

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: range-test-1.c 
	gcc/testsuite/g++.dg/opt: range-test-1.C 

Log message:
	PR tree-optimization/16372
	* fold-const.c (build_range_check): Use TYPE_MODE's precision for
	enumerals.
	
	* gcc.dg/range-test-1.c: New test.
	* g++.dg/opt/range-test-1.C: New test.

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.546&r2=2.2326.2.547
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.322.2.11&r2=1.322.2.12
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.225&r2=1.3389.2.226
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/range-test-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.8.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/range-test-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.8.1



-- 


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (2 preceding siblings ...)
  2004-07-10 18:24 ` [Bug tree-optimization/16372] [3.4/3.5 Regression] " cvs-commit at gcc dot gnu dot org
@ 2004-07-12  5:41 ` pinskia at gcc dot gnu dot org
  2004-07-27 23:32 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-12  5:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.5.0
      Known to work|                            |3.4.2 3.3.3
            Summary|[3.4/3.5 Regression] Wrong  |[3.5 Regression] Wrong code
                   |code for enums              |for enums
   Target Milestone|3.4.2                       |3.5.0


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (3 preceding siblings ...)
  2004-07-12  5:41 ` [Bug tree-optimization/16372] [3.5 " pinskia at gcc dot gnu dot org
@ 2004-07-27 23:32 ` pinskia at gcc dot gnu dot org
  2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 23:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-27 23:31 -------
*** Bug 16791 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thiessen at ncbi dot nlm dot
                   |                            |nih dot gov


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (5 preceding siblings ...)
  2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
@ 2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
  2004-07-28  1:39 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 23:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-27 23:32 -------
*** Bug 15776 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gollin at informatik dot hu-
                   |                            |berlin dot de


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (4 preceding siblings ...)
  2004-07-27 23:32 ` pinskia at gcc dot gnu dot org
@ 2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
  2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 23:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-27 23:33 -------
*** Bug 15354 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |senor_fjord at yahoo dot com


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (6 preceding siblings ...)
  2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
@ 2004-07-28  1:39 ` bangerth at dealii dot org
  2004-07-29 18:40 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28  1:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-28 01:39 -------
Just to confirm the present state: it works with 3.4.1, but doesn't 
with mainline. 
 
Jakub, what was the reason to apply this only to the 3.4 branch, and 
not to mainline? 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu dot org


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (7 preceding siblings ...)
  2004-07-28  1:39 ` bangerth at dealii dot org
@ 2004-07-29 18:40 ` jakub at gcc dot gnu dot org
  2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2004-07-29 18:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at gcc dot gnu dot org  2004-07-29 18:40 -------
The reason is rth's objection against applying this to mainline:
http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00978.html

-- 


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (8 preceding siblings ...)
  2004-07-29 18:40 ` jakub at gcc dot gnu dot org
@ 2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
  2004-08-25 20:51 ` cvs-commit at gcc dot gnu dot org
  2004-08-25 20:58 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-25 17:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-25 17:22 -------
Subject: Bug 16372

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	sayle@gcc.gnu.org	2004-08-25 17:22:10

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: pr16372-1.C pr16693-1.C pr16693-2.C 

Log message:
	PR middle-end/16693
	PR tree-optimization/16372
	* decl.c (finish_enum): Make the precision of the enumerated type
	the same width as the underlying integer type.
	
	* g++.dg/opt/pr16372-1.C: New test case.
	* g++.dg/opt/pr16693-1.C: New test case.
	* g++.dg/opt/pr16693-2.C: New test case.

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.153&r2=1.3892.2.154
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.22&r2=1.1174.2.23
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.260&r2=1.3389.2.261
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr16372-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr16693-1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr16693-2.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=16372


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (9 preceding siblings ...)
  2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-25 20:51 ` cvs-commit at gcc dot gnu dot org
  2004-08-25 20:58 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-25 20:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-25 20:51 -------
Subject: Bug 16372

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-08-25 20:51:02

Modified files:
	gcc/cp         : ChangeLog decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: pr16372-1.C pr16693-1.C pr16693-2.C 

Log message:
	PR middle-end/16693
	PR tree-optimization/16372
	* decl.c (finish_enum): Make the precision of the enumerated type
	the same width as the underlying integer type.
	
	* g++.dg/opt/pr16372-1.C: New test case.
	* g++.dg/opt/pr16693-1.C: New test case.
	* g++.dg/opt/pr16693-2.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4308&r2=1.4309
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1278&r2=1.1279
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4192&r2=1.4193
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr16372-1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr16693-1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr16693-2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug tree-optimization/16372] [3.5 Regression] Wrong code for enums
  2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
                   ` (10 preceding siblings ...)
  2004-08-25 20:51 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-25 20:58 ` pinskia at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-25 20:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-25 20:58 -------
Fixed.

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


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


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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-05 18:56 [Bug c++/16372] New: Wrong code for enums schuele at informatik dot uni-kl dot de
2004-07-05 19:03 ` [Bug c++/16372] " schuele at informatik dot uni-kl dot de
2004-07-05 21:16 ` pinskia at gcc dot gnu dot org
2004-07-10 18:24 ` [Bug tree-optimization/16372] [3.4/3.5 Regression] " cvs-commit at gcc dot gnu dot org
2004-07-12  5:41 ` [Bug tree-optimization/16372] [3.5 " pinskia at gcc dot gnu dot org
2004-07-27 23:32 ` pinskia at gcc dot gnu dot org
2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
2004-07-27 23:33 ` pinskia at gcc dot gnu dot org
2004-07-28  1:39 ` bangerth at dealii dot org
2004-07-29 18:40 ` jakub at gcc dot gnu dot org
2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
2004-08-25 20:51 ` cvs-commit at gcc dot gnu dot org
2004-08-25 20:58 ` 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).