ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 0b18db7 was
6fbe9a5,
checked in by Michael Brooks <mlbrooks@…>, 4 years ago
|
Fixing code-gen of constants. Fixes #182? Removes workaround 58b6d1.
Forcing recent GCC versions to place CFA-initialized constants in writeable memory, so CFA initialization doesn't segfault when writing them. See the const-init test for specifics about recent GCC versions.
src/InitTweak/FixGlobalInit.cc: generating the attribute to control GCC's placement
libcfa/src/limits.* : removing workaround from 58b6d1, making these limits const again
tests//limits.* : commenting old test that uses the constants from licfa-limits, explaining what the test doesn't exercise
tests//const-init.* : new test of static constants, taken from #182, and comments explaining how to test this issue
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Rev | Line | |
---|
[6fbe9a5] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2020 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
| 7 | // const-init.cfa -- tests of initializing constants |
---|
| 8 | // |
---|
| 9 | // Author : Michael Brooks |
---|
| 10 | // Created On : Tue Oct 06 22:00:00 2020 |
---|
| 11 | // Last Modified By : Michael Brooks |
---|
| 12 | // Last Modified On : Tue Oct 06 22:00:00 2020 |
---|
| 13 | // Update Count : 1 |
---|
| 14 | // |
---|
| 15 | |
---|
| 16 | /* |
---|
| 17 | |
---|
| 18 | This test shows non-crashing of generated code for constants with interesting initizers. |
---|
| 19 | The potential for these to crash is compiler dependent. |
---|
| 20 | |
---|
| 21 | There are two cases: |
---|
| 22 | 1. static constants in one compilation unit (tested here) |
---|
| 23 | 2. extern constants across compilation units (tested by libcfa being loadable, specifically |
---|
| 24 | the constant declarations in libcfa/src/limits.cfa, which almost every test exercises, |
---|
| 25 | including "hello;" but notably, the "limits" test does not exercise it because that test |
---|
| 26 | is compile-only) |
---|
| 27 | |
---|
| 28 | Crashes that we have obsrved (#182 and build failures September 2020) are because the libcfa |
---|
| 29 | initialization is writing to a global variable (which the declaring program wants typed as |
---|
| 30 | constant), while the compiler has placed this global in a read-only section. |
---|
| 31 | |
---|
| 32 | Compiler dependence includes: |
---|
| 33 | |
---|
| 34 | Case 1 Case 2 |
---|
| 35 | GCC-6 on Ubuntu 16.04 Never crashed Never crashed |
---|
| 36 | GCC-8 on both Has crashed Never crashed |
---|
| 37 | GCC-10 on Ubuntu 20.04 Has crashed Has crashed |
---|
| 38 | |
---|
| 39 | For this test case to fail, with most other tests passing, would be a situation only ever |
---|
| 40 | observed with GCC-8. |
---|
| 41 | |
---|
| 42 | */ |
---|
| 43 | |
---|
| 44 | static const char foo = -1; |
---|
| 45 | |
---|
| 46 | int main() { |
---|
| 47 | printf("done\n"); |
---|
| 48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.