[Bug 872648] [NEW] Switch gets optimized away incorrectly

Kevin O'Gorman kogorman at gmail.com
Wed Oct 12 03:35:30 UTC 2011


Public bug reported:

A program stub with a very simple switch statement is performing
incorrectly; examination of the assembler output shows that the switch
has been partially optimized away, leaving only the default case, when a
different case would be expected to execute.

This occurs in lucid (gcc-4.4) and natty (gcc-4.5.2), but I'm reporting
it as a 4.4 bug because I mostly use lucid.

I expected the program to copy stdin to stdout, one character at a time.
Instead, it fails on the first character, executing statements that I
have in the default: case.  These statements show that the switch
expression should have chosen a different case, but that case is not
even compiled into the assembler code.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gcc 4:4.4.3-1ubuntu1
ProcVersionSignature: Ubuntu 2.6.32-34.77-generic 2.6.32.44+drm33.19
Uname: Linux 2.6.32-34-generic i686
Architecture: i386
Date: Tue Oct 11 20:31:22 2011
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release i386 (20100816.1)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gcc-defaults

** Affects: gcc-defaults (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 lucid

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/872648

Title:
  Switch gets optimized away incorrectly

Status in “gcc-defaults” package in Ubuntu:
  New

Bug description:
  A program stub with a very simple switch statement is performing
  incorrectly; examination of the assembler output shows that the switch
  has been partially optimized away, leaving only the default case, when
  a different case would be expected to execute.

  This occurs in lucid (gcc-4.4) and natty (gcc-4.5.2), but I'm
  reporting it as a 4.4 bug because I mostly use lucid.

  I expected the program to copy stdin to stdout, one character at a
  time.  Instead, it fails on the first character, executing statements
  that I have in the default: case.  These statements show that the
  switch expression should have chosen a different case, but that case
  is not even compiled into the assembler code.

  ProblemType: Bug
  DistroRelease: Ubuntu 10.04
  Package: gcc 4:4.4.3-1ubuntu1
  ProcVersionSignature: Ubuntu 2.6.32-34.77-generic 2.6.32.44+drm33.19
  Uname: Linux 2.6.32-34-generic i686
  Architecture: i386
  Date: Tue Oct 11 20:31:22 2011
  InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release i386 (20100816.1)
  ProcEnviron:
   LANGUAGE=en_US:en
   PATH=(custom, user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: gcc-defaults

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/872648/+subscriptions




More information about the foundations-bugs mailing list