Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.brendan/crash24.C

raw
1 // { dg-do assemble }
2 // { dg-options "-O" }
3 // GROUPS passed old-abort
4 // gcc puts the array into a register, and then the store_bit_field () code
5 // in expmed.c gets confused when it tries to store zero past the end of the
6 // register (because the index is past the array bounds). It ends up calling
7 // store_split_bit_field, which then aborts, because we don't have a split bit
8 // field.
9 //
10 // Seems easiest to detect this case in the front end, i.e. access outside the
11 // array bounds, and then force the array to be allocated on the stack instead
12 // of a register.
13
14 int
15 main()
16 {
17 char i[1];
18
19 i[1] = 0;
20
21 return 0;
22 }