Switch gets optimized away incorrectly

Bug #872648 reported by Kevin O'Gorman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-defaults (Ubuntu)
Invalid
Undecided
Unassigned

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

Revision history for this message
Kevin O'Gorman (kogorman-pacbell) wrote :
Revision history for this message
dino99 (9d9) wrote :

This version has expired some times ago, and no backport is expected as there is no 'security' reported problem

Changed in gcc-defaults (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.