- Timestamp:
- Oct 15, 2020, 9:41:31 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- afe2939
- Parents:
- 0b18db7
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/const-init.txt
r0b18db7 rf1791a4 1 done 1 almost done 2 dtor -
tests/const-init.cfa
r0b18db7 rf1791a4 16 16 /* 17 17 18 Th is test shows non-crashing of generated code for constants with interesting initizers.18 These tests show non-crashing of generated code for constants with interesting initializers. 19 19 The potential for these to crash is compiler dependent. 20 20 21 21 There are two cases: 22 1. static constants in one compilation unit (tested here )22 1. static constants in one compilation unit (tested here, in a few sub-cases) 23 23 2. extern constants across compilation units (tested by libcfa being loadable, specifically 24 the constant de clarations in libcfa/src/limits.cfa, which almost every test exercises,24 the constant definitions in libcfa/src/limits.cfa, which almost every test exercises, 25 25 including "hello;" but notably, the "limits" test does not exercise it because that test 26 26 is compile-only) … … 37 37 GCC-10 on Ubuntu 20.04 Has crashed Has crashed 38 38 39 For this test caseto fail, with most other tests passing, would be a situation only ever39 For this test to fail, with most other tests passing, would be a situation only ever 40 40 observed with GCC-8. 41 41 42 42 */ 43 43 44 // initailized by generated function, called before main 44 45 static const char foo = -1; 45 46 47 struct thing{}; 48 void ^?{}( thing & ) { printf("dtor\n"); } 49 46 50 int main() { 47 printf("done\n"); 51 // foo is already initialized 52 53 // no dtor => stays a (static) local, initialized here 54 static const char bar = -1; 55 56 // has dtor => becomes a global, ctor called here, dtor called at exit 57 static const thing it; 58 59 printf("almost done\n"); 48 60 }
Note: See TracChangeset
for help on using the changeset viewer.