public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16791] New: comparison test for enum values fails when optimized
@ 2004-07-27 23:26 thiessen at ncbi dot nlm dot nih dot gov
  2004-07-27 23:31 ` [Bug c++/16791] " pinskia at gcc dot gnu dot org
  2004-07-28  1:42 ` bangerth at dealii dot org
  0 siblings, 2 replies; 3+ messages in thread
From: thiessen at ncbi dot nlm dot nih dot gov @ 2004-07-27 23:26 UTC (permalink / raw)
  To: gcc-bugs

This looks a lot like bug #15069, which was marked fixed for 3.4.1 (as far as I 
can tell - I'm new to GCC Bugzilla). However, I'm using GCC 3.4.1 on linux, and 
I'm seeing a problem with the code:

#include <iostream>
using namespace std;

  // atom type
  enum eAtomClassification {
    eSideChainAtom,
    eAlphaBackboneAtom,
    ePartialBackboneAtom,
    eCompleteBackboneAtom,
    eUnknownAtom
  };

int main(int argc, char **argv)
{
  eAtomClassification classification = eUnknownAtom;

  if ((classification == eAlphaBackboneAtom) ||
      (classification == ePartialBackboneAtom) ||
      (classification == eCompleteBackboneAtom))
  {
    cout << "error:\n";
    cout << "class " << classification << "\n" << flush;
    cout << eAlphaBackboneAtom << " "
         << ePartialBackboneAtom
         << " " << eCompleteBackboneAtom << "\n" << flush;
    return 1;
  }

  cout << "okay\n";
  return 0;
}

When compiled with optimization, it doesn't execute properly:

(trans)(~/tmp) g++ -O1 -o gcc-bug-2 gcc-bug-2.cpp
(trans)(~/tmp) gcc-bug-2
error:
class 4
1 2 3
(trans)(~/tmp) g++ -O2 -o gcc-bug-2 gcc-bug-2.cpp
(trans)(~/tmp) gcc-bug-2
error:
class 4
1 2 3
(trans)(~/tmp) g++ -O0 -o gcc-bug-2 gcc-bug-2.cpp
(trans)(~/tmp) gcc-bug-2
okay

Is this the same bug #15069, or is it something different? In any case, it's not 
working in 3.4.1... My version:

(trans)(~/tmp) g++ -v
Reading specs from /usr/lib/gcc-3.4.1/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ./configure --prefix=/usr/local/gcc-3.4.1 
--libdir=/usr/lib/gcc-3.4.1 --with-include=/usr/local/gcc-3.4.1/include 
--enable-threads --enable-shared --enable-languages=c,c++,f77,java 
--with-gxx-include-dir=/usr/local/gcc-3.4.1/include/g++-v3
Thread model: posix
gcc version 3.4.1

-- 
           Summary: comparison test for enum values fails when optimized
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thiessen at ncbi dot nlm dot nih dot gov
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/16791] comparison test for enum values fails when optimized
  2004-07-27 23:26 [Bug c++/16791] New: comparison test for enum values fails when optimized thiessen at ncbi dot nlm dot nih dot gov
@ 2004-07-27 23:31 ` pinskia at gcc dot gnu dot org
  2004-07-28  1:42 ` bangerth at dealii dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-27 23:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-27 23:31 -------


*** This bug has been marked as a duplicate of 16372 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c++/16791] comparison test for enum values fails when optimized
  2004-07-27 23:26 [Bug c++/16791] New: comparison test for enum values fails when optimized thiessen at ncbi dot nlm dot nih dot gov
  2004-07-27 23:31 ` [Bug c++/16791] " pinskia at gcc dot gnu dot org
@ 2004-07-28  1:42 ` bangerth at dealii dot org
  1 sibling, 0 replies; 3+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28  1:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-07-28 01:42 -------
This is indeed fixed on the 3.4 branch, while it still exists in 
mainline. That's the same as the bug to which it was marked as 
a duplicate. 
 
W. 

-- 


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


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

end of thread, other threads:[~2004-07-28  1:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-27 23:26 [Bug c++/16791] New: comparison test for enum values fails when optimized thiessen at ncbi dot nlm dot nih dot gov
2004-07-27 23:31 ` [Bug c++/16791] " pinskia at gcc dot gnu dot org
2004-07-28  1:42 ` bangerth at dealii 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).