Clang Project

clang_source_code/test/CodeGen/msp430-reloc.c
1// REQUIRES: msp430-registered-target
2// RUN: %clang -target msp430 -fPIC -S %s -o - | FileCheck %s
3
4// Check the compilation does not crash as it was crashing before with "-fPIC" enabled
5
6void *alloca(unsigned int size);
7
8// CHECK: .globl foo
9short foo(char** data, char encoding)
10{
11 char* encoding_addr = alloca(sizeof(char));
12 *encoding_addr = encoding;
13
14 char tmp3 = *encoding_addr;
15 short conv2 = tmp3;
16 short and = conv2 & 0xf;
17
18 switch (and)
19 {
20 case 0 :
21 case 4 :
22 case 10 :
23 return 1;
24 case 11 :
25 return 2;
26 }
27
28 return 0;
29}
30
31