On Thu, Dec 21, 2017 at 5:32 AM, Yunlian Jiang <yunl...@google.com> wrote: > > When I run > busybox ash on an arm device with busybox built with clang 6. > I got a segmentation fault > in the macro > #define INIT_S() do { \ > (*(struct lineedit_statics**)&lineedit_ptr_to_statics) = xzalloc(sizeof(S)); \ > barrier(); \ > cmdedit_termw = 80; \ > IF_USERNAME_OR_HOMEDIR(home_pwd_buf = (char*)null_str;) \ > IF_FEATURE_EDITING_VI(delptr = delbuf;) \ > } while (0) > > With the patch below, the segmentation disappears. > > --- busybox-1.27.2/libbb/lineedit.c > +++ busybox-1.27.2/libbb/lineedit.c > @@ -197,8 +197,8 @@ extern struct lineedit_statics *const li > (*(struct lineedit_statics**)&lineedit_ptr_to_statics) = > xzalloc(sizeof(S)); \ > barrier(); \ > cmdedit_termw = 80; \ > - IF_USERNAME_OR_HOMEDIR(home_pwd_buf = (char*)null_str;) \ > - IF_FEATURE_EDITING_VI(delptr = delbuf;) \ > + IF_USERNAME_OR_HOMEDIR(home_pwd_buf = (char*)null_str;); \ > + IF_FEATURE_EDITING_VI(delptr = delbuf;); \ > } while (0) > > static void deinit_S(void)
What's the problem of the missing semicolons in the build? BusyBox has been using these constructs almost everywhere. And they should succeed. Could you show us the generated code differences? It looks like a bug in the compiler, and nothing to do with Busybox. _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox