LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 37 - [cbackend] Fall through branches in switch instructions are miscompiled
Summary: [cbackend] Fall through branches in switch instructions are miscompiled
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: C (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Chris Lattner
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2003-10-13 15:17 PDT by Chris Lattner
Modified: 2010-03-06 13:51 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2003-10-13 15:17:02 PDT
The following testcase is horribly mangled by the c backend.
This is distilled from a gigantic switch statement in 253.perlbmk.

#include <stdio.h>

int main(int argc) {
   switch (argc) {
   default:
     printf("GOOD\n");
     return 0;
   case 100: 
   case 101:
   case 1023:
     printf("BAD\n");
     return 1;
   }
}
Comment 1 Chris Lattner 2003-10-13 15:31:42 PDT
This is test: test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c
Comment 2 Chris Lattner 2003-10-13 15:33:29 PDT
This is now fixed!
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20031013/008044.html