public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision
@ 2004-07-23 17:15 paulg at chiark dot greenend dot org dot uk
  2004-07-23 17:18 ` [Bug c++/16693] " paulg at chiark dot greenend dot org dot uk
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: paulg at chiark dot greenend dot org dot uk @ 2004-07-23 17:15 UTC (permalink / raw)
  To: gcc-bugs

The following code produces incorrect results when compiled with GCC 3.4.0 and
3.4.1. With both of these compilers the bitwise "AND" gets ignored and the value
of "r1" ends up as 0x66 rather than 0x6. GCC 3.3.3 generates the correct answer
as does GCC 3.5.0 snapshot taken on 20040717.

The console output of the compiler during this run was:

Reading specs from /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/lib/gcc/i686-pc
-linux-gnu/3.4.1/specs
Configured with: ./configure --prefix=/arm/eda/tools/gnu/gcc/3_4_1 --exec-prefix
=/arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86 --program-suffix=-3_4_1 -v --with
-dwarf2 --enable-version-specific-runtime-libs --with-gnu-as --with-as=/arm/eda/
tools/gnu/binutils/2_15_90_0_3/linux_rh_7_2-x86/bin/as-2_15_90_0_3 --with-gnu-ld
 --with-ld=/arm/eda/tools/gnu/binutils/2_15_90_0_3/linux_rh_7_2-x86/bin/ld-2_15_
90_0_3
Thread model: posix
gcc version 3.4.1
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/libexec/gcc/i686-pc-linux-gnu/3.4
.1/cc1plus -E -quiet -v -D_GNU_SOURCE tst_gcc.cpp -mtune=pentiumpro -o tst_gcc.i
i
ignoring nonexistent directory "/arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/li
b/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/lib/gcc/i686-pc-linux-gnu/3.4.1/i
nclude/c++
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/lib/gcc/i686-pc-linux-gnu/3.4.1/i
nclude/c++/i686-pc-linux-gnu
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/lib/gcc/i686-pc-linux-gnu/3.4.1/i
nclude/c++/backward
 /usr/local/include
 /arm/eda/tools/gnu/gcc/3_4_1/include
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/lib/gcc/i686-pc-linux-gnu/3.4.1/i
nclude
 /usr/include
End of search list.
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/libexec/gcc/i686-pc-linux-gnu/3.4
.1/cc1plus -fpreprocessed tst_gcc.ii -quiet -dumpbase tst_gcc.cpp -mtune=pentium
pro -auxbase tst_gcc -version -o tst_gcc.s
GNU C++ version 3.4.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=129190
 /arm/eda/tools/gnu/binutils/2_15_90_0_3/linux_rh_7_2-x86/bin/as-2_15_90_0_3 -V 
-Qy -o tst_gcc.o tst_gcc.s
GNU assembler version 2.15.90.0.3 (i686-pc-linux-gnu) using BFD version 2.15.90.
0.3 20040415
 /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/libexec/gcc/i686-pc-linux-gnu/3.4
.1/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o tst
_gcc /usr/lib/crt1.o /usr/lib/crti.o /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x
86/lib/gcc/i686-pc-linux-gnu/3.4.1/crtbegin.o -L/arm/eda/tools/gnu/gcc/3_4_1/lin
ux_rh_7_2-x86/lib/gcc/i686-pc-linux-gnu/3.4.1 -L/arm/eda/tools/gnu/gcc/3_4_1/lin
ux_rh_7_2-x86/lib/gcc/i686-pc-linux-gnu/3.4.1/../../.. tst_gcc.o -lstdc++ -lm -l
gcc_s -lgcc -lc -lgcc_s -lgcc /arm/eda/tools/gnu/gcc/3_4_1/linux_rh_7_2-x86/lib/
gcc/i686-pc-linux-gnu/3.4.1/crtend.o /usr/lib/crtn.o

----
#include <iostream>

unsigned short ret6666(int) {
    return 0x66;
}

typedef enum {
    a   = 0x0, b   = 0x1, c   = 0x2, d   = 0x3, e   = 0x4, f   = 0x5,
    g   = 0x6, h   = 0x7, i   = 0x8, j   = 0x9, k   = 0xa, l   = 0xb,
    m   = 0xc, n   = 0xd, o   = 0xe, p   = 0xf 
} Test_Enum;

int main(void) {
    unsigned char r1;
    r1 = static_cast<Test_Enum>(0xf & ret6666(44));

    if(r1 == 0x6) {
        std::cout << "Passed" << std::endl;
        exit(0);
    } else {
        std::cout << "Failed" << std::endl;
        exit(1);
    }
}

-- 
           Summary: Bitwise AND is lost when used within a cast to an enum
                    of the same precision
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paulg at chiark dot greenend dot org dot uk
                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=16693


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

* [Bug c++/16693] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
@ 2004-07-23 17:18 ` paulg at chiark dot greenend dot org dot uk
  2004-07-23 17:20 ` paulg at chiark dot greenend dot org dot uk
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulg at chiark dot greenend dot org dot uk @ 2004-07-23 17:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paulg at chiark dot greenend dot org dot uk  2004-07-23 17:18 -------
Created an attachment (id=6814)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6814&action=view)
Preprocessed output of the code in the defect report


-- 


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


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

* [Bug c++/16693] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
  2004-07-23 17:18 ` [Bug c++/16693] " paulg at chiark dot greenend dot org dot uk
@ 2004-07-23 17:20 ` paulg at chiark dot greenend dot org dot uk
  2004-07-23 17:22 ` [Bug c++/16693] [3.4 Regression] " pinskia at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulg at chiark dot greenend dot org dot uk @ 2004-07-23 17:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.0 3.4.1
      Known to work|                            |3.3.3 3.5.0
            Summary|Bitwise AND is lost when    |Bitwise AND is lost when
                   |used within a cast to an    |used within a cast to an
                   |enum of the same precision  |enum of the same precision


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


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

* [Bug c++/16693] [3.4 Regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
  2004-07-23 17:18 ` [Bug c++/16693] " paulg at chiark dot greenend dot org dot uk
  2004-07-23 17:20 ` paulg at chiark dot greenend dot org dot uk
@ 2004-07-23 17:22 ` pinskia at gcc dot gnu dot org
  2004-07-23 19:04 ` [Bug c++/16693] [3.4/3.5 regression] " bangerth at dealii dot org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-23 17:22 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
            Summary|Bitwise AND is lost when    |[3.4 Regression] Bitwise AND
                   |used within a cast to an    |is lost when used within a
                   |enum of the same precision  |cast to an enum of the same
                   |                            |precision
   Target Milestone|---                         |3.4.2


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (2 preceding siblings ...)
  2004-07-23 17:22 ` [Bug c++/16693] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2004-07-23 19:04 ` bangerth at dealii dot org
  2004-07-23 19:06 ` bangerth at dealii dot org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: bangerth at dealii dot org @ 2004-07-23 19:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-23 19:04 -------
Confirmed. A regression in 3.4 and mainline against 3.3.4. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-23 19:04:45
               date|                            |
            Summary|[3.4 Regression] Bitwise AND|[3.4/3.5 regression] Bitwise
                   |is lost when used within a  |AND is lost when used within
                   |cast to an enum of the same |a cast to an enum of the
                   |precision                   |same precision


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (3 preceding siblings ...)
  2004-07-23 19:04 ` [Bug c++/16693] [3.4/3.5 regression] " bangerth at dealii dot org
@ 2004-07-23 19:06 ` bangerth at dealii dot org
  2004-07-24  0:10 ` paulg at chiark dot greenend dot org dot uk
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: bangerth at dealii dot org @ 2004-07-23 19:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-23 19:06 -------
BTW, my mainline snapshot from 2004-07-21 fails this testcase, too. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 3.4.1                 |3.4.0 3.4.1 3.5.0
      Known to work|3.3.3 3.5.0                 |3.3.3


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (4 preceding siblings ...)
  2004-07-23 19:06 ` bangerth at dealii dot org
@ 2004-07-24  0:10 ` paulg at chiark dot greenend dot org dot uk
  2004-07-26 13:03 ` paulg at chiark dot greenend dot org dot uk
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulg at chiark dot greenend dot org dot uk @ 2004-07-24  0:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paulg at chiark dot greenend dot org dot uk  2004-07-24 00:10 -------
I've now tried this on SPARC as well as i686 and I get the same results which
suggests this is a front end rather than a target specific problem.

-- 


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (5 preceding siblings ...)
  2004-07-24  0:10 ` paulg at chiark dot greenend dot org dot uk
@ 2004-07-26 13:03 ` paulg at chiark dot greenend dot org dot uk
  2004-07-26 13:50 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: paulg at chiark dot greenend dot org dot uk @ 2004-07-26 13:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From paulg at chiark dot greenend dot org dot uk  2004-07-26 13:02 -------
A collegue has done some more investigation and come up with the following
additional constraints.

If the enum pushes into the top nibble then the problem does not occur.

A similar problem occurs with unsigned short where the problem occurs if the
enumeration fits into a byte.

If the target variable is an unsigned int rather than a unsigned char or short
the problem does not occur.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.3.3                       |3.3.3 3.3.4


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (6 preceding siblings ...)
  2004-07-26 13:03 ` paulg at chiark dot greenend dot org dot uk
@ 2004-07-26 13:50 ` pinskia at gcc dot gnu dot org
  2004-08-10  1:25 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-26 13:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-26 13:50 -------
I think this is caused by fold which does the following transformation:
(cast)(a & constant) -> ((cast)a) & ((cast)constant).

-- 


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (7 preceding siblings ...)
  2004-07-26 13:50 ` pinskia at gcc dot gnu dot org
@ 2004-08-10  1:25 ` pinskia at gcc dot gnu dot org
  2004-08-10  9:05 ` reichelt at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-10  1:25 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical


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


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

* [Bug c++/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (8 preceding siblings ...)
  2004-08-10  1:25 ` pinskia at gcc dot gnu dot org
@ 2004-08-10  9:05 ` reichelt at gcc dot gnu dot org
  2004-08-19 21:31 ` [Bug middle-end/16693] " mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-08-10  9:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-08-10 09:05 -------
Here's a condensed version (which should return 0):

=====================================
char foo()
{
    return 0x10;
}

enum E { e = 0x0f };

int main()
{
    return (char)(E)(e & foo());
}
=====================================

Btw, the bug only occurs with the C++ frontend and not with plain C.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Keywords|                            |monitored


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


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

* [Bug middle-end/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (9 preceding siblings ...)
  2004-08-10  9:05 ` reichelt at gcc dot gnu dot org
@ 2004-08-19 21:31 ` mmitchel at gcc dot gnu dot org
  2004-08-20  9:33 ` rearnsha at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-19 21:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-19 21:31 -------
This is a duplicate of some other PR -- I'm just not sure which.

In C++, the compiler can assume that there will be no values of the enum greater
than 0xf, given the declaration.  That is why the compiler omits the bitwise-and.

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


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


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

* [Bug middle-end/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (10 preceding siblings ...)
  2004-08-19 21:31 ` [Bug middle-end/16693] " mmitchel at gcc dot gnu dot org
@ 2004-08-20  9:33 ` rearnsha at gcc dot gnu dot org
  2004-08-22 23:30 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2004-08-20  9:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2004-08-20 09:33 -------
The bitwise and is applied to something that isn't an enumerated type (it's
wider than that), and it's whole purpose is to reduce the value to something
that then *can* be cast to the enumerated type.

It's not as if the user had written


0xf & static_cast<Test_Enum>(ret6666(44));

Which would be incorrect.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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


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

* [Bug middle-end/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (11 preceding siblings ...)
  2004-08-20  9:33 ` rearnsha at gcc dot gnu dot org
@ 2004-08-22 23:30 ` mmitchel at gcc dot gnu dot org
  2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-22 23:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-22 23:30 -------
I agree.

Roger, I think this is a problem in fold with this code:

      /* Convert (T)(x & c) into (T)x & (T)c, if c is an integer
         constants (if x has signed type, the sign bit cannot be set
         in c).  This folds extension into the BIT_AND_EXPR.  */
      if (INTEGRAL_TYPE_P (type)
          && TREE_CODE (type) != BOOLEAN_TYPE
          && TREE_CODE (TREE_OPERAND (t, 0)) == BIT_AND_EXPR
          && TREE_CODE (TREE_OPERAND (TREE_OPERAND (t, 0), 1)) == INTEGER_CST)
 
The problem is that we turn:

  (enum E) ((unsigned int) (expr) & 0xf)

into:

  (E) (unsigned int) (expr) & (E) 0xf

which is not valid because "expr" may not be within the range of "E".  (In this
case "E" has the range [0, 0xf].)  The original code has a well-defined meaning;
the resulting code has an "unspecified" meaning according to the C++ standard. 
I think this transformation is only safe if the values can be shown to be in
range, as would be the case if the TYPE_PRECISION of "E" was as big as that of
"unsigned int".

Therefore, I've assigned this bug to you.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at eyesopen dot com
         AssignedTo|unassigned at gcc dot gnu   |roger at eyesopen dot com
                   |dot org                     |
             Status|REOPENED                    |ASSIGNED


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


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

* [Bug middle-end/16693] [3.4/3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (12 preceding siblings ...)
  2004-08-22 23:30 ` mmitchel at gcc dot gnu dot org
@ 2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
  2004-08-25 17:28 ` [Bug middle-end/16693] [3.5 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ 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 16693

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=16693


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

* [Bug middle-end/16693] [3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (13 preceding siblings ...)
  2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-25 17:28 ` pinskia at gcc dot gnu dot org
  2004-08-25 20:51 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-25 17:28 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.3.3 3.3.4                 |3.3.3 3.3.4 3.4.2
            Summary|[3.4/3.5 regression] Bitwise|[3.5 regression] Bitwise AND
                   |AND is lost when used within|is lost when used within a
                   |a cast to an enum of the    |cast to an enum of the same
                   |same precision              |precision
   Target Milestone|3.4.2                       |3.5.0


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


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

* [Bug middle-end/16693] [3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (14 preceding siblings ...)
  2004-08-25 17:28 ` [Bug middle-end/16693] [3.5 " pinskia 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
  2004-08-26 12:33 ` rearnsha at gcc dot gnu dot org
  17 siblings, 0 replies; 19+ 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 16693

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=16693


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

* [Bug middle-end/16693] [3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (15 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
  2004-08-26 12:33 ` rearnsha at gcc dot gnu dot org
  17 siblings, 0 replies; 19+ 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|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug middle-end/16693] [3.5 regression] Bitwise AND is lost when used within a cast to an enum of the same precision
  2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
                   ` (16 preceding siblings ...)
  2004-08-25 20:58 ` pinskia at gcc dot gnu dot org
@ 2004-08-26 12:33 ` rearnsha at gcc dot gnu dot org
  17 siblings, 0 replies; 19+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2004-08-26 12:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rearnsha at gcc dot gnu dot org  2004-08-26 12:33 -------
Milestone update for release note extraction.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 3.4.1 3.5.0           |3.4.0 3.4.1
      Known to work|3.3.3 3.3.4 3.4.2           |3.3.3 3.3.4 3.4.2 3.5.0
   Target Milestone|3.5.0                       |3.4.2


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


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

end of thread, other threads:[~2004-08-26 12:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-23 17:15 [Bug c++/16693] New: Bitwise AND is lost when used within a cast to an enum of the same precision paulg at chiark dot greenend dot org dot uk
2004-07-23 17:18 ` [Bug c++/16693] " paulg at chiark dot greenend dot org dot uk
2004-07-23 17:20 ` paulg at chiark dot greenend dot org dot uk
2004-07-23 17:22 ` [Bug c++/16693] [3.4 Regression] " pinskia at gcc dot gnu dot org
2004-07-23 19:04 ` [Bug c++/16693] [3.4/3.5 regression] " bangerth at dealii dot org
2004-07-23 19:06 ` bangerth at dealii dot org
2004-07-24  0:10 ` paulg at chiark dot greenend dot org dot uk
2004-07-26 13:03 ` paulg at chiark dot greenend dot org dot uk
2004-07-26 13:50 ` pinskia at gcc dot gnu dot org
2004-08-10  1:25 ` pinskia at gcc dot gnu dot org
2004-08-10  9:05 ` reichelt at gcc dot gnu dot org
2004-08-19 21:31 ` [Bug middle-end/16693] " mmitchel at gcc dot gnu dot org
2004-08-20  9:33 ` rearnsha at gcc dot gnu dot org
2004-08-22 23:30 ` mmitchel at gcc dot gnu dot org
2004-08-25 17:22 ` cvs-commit at gcc dot gnu dot org
2004-08-25 17:28 ` [Bug middle-end/16693] [3.5 " pinskia 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
2004-08-26 12:33 ` rearnsha 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).