diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-01-24 09:04:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-24 09:04:31 -0800 |
| commit | a5bfbbc12a95684371a76cd87585299e5e874552 (patch) | |
| tree | 27a8fbafbd45c6123480cf6438ee0a7cfa485fcc /py | |
| parent | fe851fc15e2f02734133c9a2874bf3b407332f65 (diff) | |
| parent | 1e94c4240cb12fcbb65831e608a9408e1e76fd87 (diff) | |
Merge pull request #548 from dhalbert/3.0_alloca_problem_issue_521
alloca seems buggy on M4
Diffstat (limited to 'py')
| -rw-r--r-- | py/runtime.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c index cbec82f17..7a16e4a1b 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1428,9 +1428,10 @@ import_error: mp_load_method_maybe(module, MP_QSTR___name__, dest); size_t pkg_name_len; const char *pkg_name = mp_obj_str_get_data(dest[0], &pkg_name_len); - const uint dot_name_len = pkg_name_len + 1 + qstr_len(name); - char *dot_name = alloca(dot_name_len); + // Previously dot_name was created using alloca(), but that caused run-time crashes on M4 due to + // stack corruption (compiler bug, it appears), so use an array instead. + char dot_name[dot_name_len]; memcpy(dot_name, pkg_name, pkg_name_len); dot_name[pkg_name_len] = '.'; memcpy(dot_name + pkg_name_len + 1, qstr_str(name), qstr_len(name)); |
