File tree 2 files changed +4
-3
lines changed 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
144
144
}
145
145
146
146
mp_obj_t retval = mp_obj_new_list (0 , NULL );
147
- const char * * caps = alloca ( caps_num * sizeof ( char * )) ;
147
+ const char * caps [ caps_num ] ;
148
148
while (true) {
149
149
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
150
150
memset ((char * * )caps , 0 , caps_num * sizeof (char * ));
Original file line number Diff line number Diff line change @@ -1428,9 +1428,10 @@ mp_obj_t mp_import_from(mp_obj_t module, qstr name) {
1428
1428
mp_load_method_maybe (module , MP_QSTR___name__ , dest );
1429
1429
size_t pkg_name_len ;
1430
1430
const char * pkg_name = mp_obj_str_get_data (dest [0 ], & pkg_name_len );
1431
-
1432
1431
const uint dot_name_len = pkg_name_len + 1 + qstr_len (name );
1433
- char * dot_name = alloca (dot_name_len );
1432
+ // Previously dot_name was created using alloca(), but that caused run-time crashes on M4 due to
1433
+ // stack corruption (compiler bug, it appears), so use an array instead.
1434
+ char dot_name [dot_name_len ];
1434
1435
memcpy (dot_name , pkg_name , pkg_name_len );
1435
1436
dot_name [pkg_name_len ] = '.' ;
1436
1437
memcpy (dot_name + pkg_name_len + 1 , qstr_str (name ), qstr_len (name ));
You can’t perform that action at this time.
0 commit comments