Debian Bug report logs - #496965
g++-4.3-multilib: Bad code generation for enum switch -m32

version graph

Package: g++-4.3-multilib; Maintainer for g++-4.3-multilib is Debian GCC Maintainers <debian-gcc@lists.debian.org>;

Reported by: Guillaume Morin <guillaume@morinfr.org>

Date: Thu, 28 Aug 2008 20:27:03 UTC

Severity: important

Found in version gcc-4.3/4.3.1-9

Done: "GUILLAUME MORIN, BLOOMBERG/ 731 LEXIN" <gmorin1@bloomberg.net>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#496965; Package g++-4.3-multilib. Full text and rfc822 format available.

Acknowledgement sent to Guillaume Morin <guillaume@morinfr.org>:
New Bug report received and forwarded. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Guillaume Morin <guillaume@morinfr.org>
To: submit@bugs.debian.org
Subject: g++-4.3-multilib: Bad code generation for enum switch -m32
Date: Thu, 28 Aug 2008 22:23:32 +0200
Package: g++-4.3-multilib
Version: 4.3.1-9
Severity: important

g++ generates bad code for this program.  It works with fine in 64-bit and
with older versions of gcc.  I chose severity important because it is a silent
bad code generation, and it was working fine with previous versions of  
gcc (feel free to downgrade it though)

#include <stdlib.h>
struct MyTypes {
    enum Type {
        NOVALUE = 1,
        VALUE   = 30,
        VALUE2 = 31,
        VALUE3 = -3
    };

    static bool isValue(MyTypes::Type value);
};

bool MyTypes::isValue(MyTypes::Type value)
{
    switch (value) {
      case MyTypes::VALUE:
      case MyTypes::VALUE2:
      case MyTypes::VALUE3: {
        return true;
      }
      default: {
        return false;
      }
    }
}

int main(int argc, char *argv[])
{
    if (true == MyTypes::isValue(MyTypes::Type(32))) {
        abort();
    }
    return 0;
}

guillaum@canard:~$ g++ -m32 -Wall -o e enumtest.cpp
guillaum@canard:~$ ./e
Aborted
guillaum@canard:~$ g++ -Wall -o e enumtest.cpp
guillaum@canard:~$ ./e
guillaum@canard:~$ g++-4.2 -m32 -Wall -o e enumtest.cpp
guillaum@canard:~$ ./e
guillaum@canard:~$ g++-4.1 -m32 -Wall -o e enumtest.cpp
guillaum@canard:~$ ./e

It works with -O2 though (not -O1):
guillaum@canard:~$ g++ -O2 -m32 -Wall -o e enumtest.cpp
guillaum@canard:~$ ./e


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.ISO-8859-15, LC_CTYPE=en_US.ISO-8859-15  
(charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.3-multilib depends on:
ii  g++-4.3                       4.3.1-9    The GNU C++ compiler
ii  gcc-4.3-base                  4.3.1-9    The GNU Compiler Collection (base
ii  gcc-4.3-multilib              4.3.1-9    The GNU C compiler  
(multilib files
ii  lib32stdc++6                  4.3.1-9    The GNU Standard C++  
Library v3 (3

g++-4.3-multilib recommends no packages.

Versions of packages g++-4.3-multilib suggests:
ii  lib32stdc++6-4.3-dbg          4.3.1-9    The GNU Standard C++  
Library v3 (d

-- no debconf information


-- 
Guillaume Morin <guillaume@morinfr.org>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





Information stored:
Bug#496965; Package g++-4.3-multilib. Full text and rfc822 format available.

Acknowledgement sent to Guillaume Morin <guillaume@morinfr.org>:
Extra info received and filed, but not forwarded. Full text and rfc822 format available.

Message #10 received at 496965-quiet@bugs.debian.org (full text, mbox):

From: Guillaume Morin <guillaume@morinfr.org>
To: 496965-quiet@bugs.debian.org
Subject: forwarded to the gcc bug tracking system
Date: Fri, 29 Aug 2008 18:30:30 +0200
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37281

-- 
Guillaume Morin <guillaume@morinfr.org>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 27 Sep 2008 07:29:25 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 19 15:16:20 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.