]> git.sur5r.net Git - cc65/blob - test/ref/cc65090910.c
remote TABs in doc/ and test/
[cc65] / test / ref / cc65090910.c
1 /*
2   !!DESCRIPTION!! optimizer bug
3   !!ORIGIN!!      testsuite
4   !!LICENCE!!     Public Domain
5   !!AUTHOR!!      Oliver Schmidt
6 */
7
8 #include <stdio.h>
9
10 /*
11 After spending a "little" time I finally succeeded in isolating an
12 (maybe THE) optimizer bug causing Contiki to fail.
13
14 From my user perspective it is very interesting that the bug shows up
15 with compiler option -O but does _not_ show up with -Oi.
16 */
17
18 unsigned htons(unsigned val)
19 {
20         return (((unsigned) (val)) << 8) | (((unsigned) (val)) >> 8);
21 }
22
23 int main(void)
24 {
25     printf("%x -> %x\n", 0x1234, htons(0x1234) & 0xffff);
26
27     return 0;
28 }