On Fri, Nov 8, 2019 at 8:35 AM Torbjörn Granlund <t...@gmplib.org> wrote:
> Jack Howarth <howarth.mailing.li...@gmail.com> writes: > > FYI, I reported this issue to Apple via radar and their response was... > > Engineering has provided the following information regarding this issue: > It sounds like gmp has a memory corruption issue which -fstack-check has > uncovered. We suggest filing a bug with the developers of gmp. > > So they believe clang is accurately detecting a bug in gmp. A back trace > of > the failure shows... > > bash-3.2# lldb ./t-powm > lldb ./t-powm > (lldb) target create "./t-powm" > Current executable set to './t-powm' (x86_64). > (lldb) r > Process 39643 launched: > '/Users/howarth/gmp_regression/default_build/t-powm' (x86_64) > Process 39643 stopped > * thread #1, queue = 'com.apple.main-thread', stop reason = > EXC_BAD_ACCESS > (code=EXC_I386_GPFLT) > frame #0: 0x00007fff71afc386 > libdyld.dylib`stack_not_16_byte_aligned_error > libdyld.dylib`stack_not_16_byte_aligned_error: > -> 0x7fff71afc386 <+0>: movdqa %xmm0, (%rsp) > 0x7fff71afc38b <+5>: int3 > 0x7fff71afc38c <+6>: nop > 0x7fff71afc38d <+7>: nop > Target 0: (t-powm) stopped. > (lldb) bt > * thread #1, queue = 'com.apple.main-thread', stop reason = > EXC_BAD_ACCESS > (code=EXC_I386_GPFLT) > * frame #0: 0x00007fff71afc386 > libdyld.dylib`stack_not_16_byte_aligned_error > > I am attaching the test case I created for them. Note that the failure > can > be triggered with only the t-powm executable built using the default > stack > checking so the problem seems to lie there and not in the gmp shared > libraries. > > I cannot repro on a Intel broadwell Mac Air laptop. > > Can you help read the above output? In what GMP function does the > poorly aligned stack occur? > > If it's in mpn_powm, I cannot see how it could be GMP's fault as that > function is in C and never called by our asm. Thus compiler error. > > In a leaf (asm) function, stack alignment is not relevant unless > instructions requiring a certain alignment are used. > > The only scenario which I can see where this would be a GMP bug is if an > asm GMP function made a function call without ensuring proper alignment. > But GMP very rarely make such calls; in fact I can only think of a few > places where that is done. > > -- > Torbjörn > Please encrypt, key id 0xC8601622 > Torbjörn, Are you using the clang from Xcode 11? Apple clang version 11.0.0 (clang-1100.0.33.12) Target: x86_64-apple-darwin19.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin The LLVM clang 9.0.0 doesn't show the issue with its stack checking as I believe Apple added some custom stack checking code that might not have landed back upstream yet. Jack _______________________________________________ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs