gcc/testsuite/gcc.c-torture/execute/991112-1.c
raw| 1 | /* This code was miscompiled at -O3 on x86. |
| 2 | Reported by Jim Meyering; distilled from bash. */ |
| 3 | |
| 4 | void abort(void); |
| 5 | int isprint (int); |
| 6 | |
| 7 | int rl_show_char (int c) { return 0; } |
| 8 | |
| 9 | int rl_character_len (int c, int pos) |
| 10 | { |
| 11 | return isprint (c) ? 1 : 2; |
| 12 | } |
| 13 | |
| 14 | int main(void) |
| 15 | { |
| 16 | int (*x)(int, int) = rl_character_len; |
| 17 | if (x('a', 1) != 1) |
| 18 | abort(); |
| 19 | if (x('\002', 1) != 2) |
| 20 | abort(); |
| 21 | return 0; |
| 22 | } |