[PATCH] Inline assembly division needs __volatile__

Ximin Luo infinity0 at pwned.gg
Wed Nov 8 11:46:00 UTC 2017


Torbjörn Granlund:
> Ximin Luo <infinity0 at pwned.gg> writes:
> 
>   Any chance my patch could be tested and merged?
> 
> I tried applying it, but it fails for the current head.  Manual merging
> is required.  (It applies flawlessly to GMP 6.1, though.)
> 
> If you could modify your patch to apply to the GMP head, then that would
> help.  The repo is here: https://gmplib.org/repo/gmp/
> 

I've rebased, tidied up the whitespace, and added a test case - see attached patches. However, I'm not sure the test case will be very useful since it is GCC-7.2 specific, is only for x86-64, and is sensitive to being changed in a way that might make GCC-7.2 not perform the target optimisation. You can decide whether to keep it...

(I assigned copyright to FSF to be consistent with the other files, I assume something this small doesn't need a specific CLA/waiver...)

>   I did not ask other projects' opinions on this yet, since they seemed
>   to have copied the code from GMP. Could you confirm that GMP is the
>   original source?
> 
> I originally wrote it for use in GCC, glibc, and GMP.  I only actively
> maintain the GMP version.
> 
> (The versions has diverged, unfortunately.  The GMP version now contains
> some GMPisms which might need cleaning up if we want to make the
> versions converge.)
> 

That would be good yes... would also be a good to put a warning at the top of that file along the lines of "the original version is from GMP at address <URL>, please submit all change requests there rather than this project, and update regularly".

Might also be a good idea to expose it as a public header file, then at least projects that already depend on GMP (e.g. flint and other scientific stuff) can just #include it instead of copying it.

X

-- 
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-test-for-udiv-faulty-optimisation-fixed-next-com.patch
Type: text/x-patch
Size: 2751 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20171108/be51c1f9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Inline-assembly-division-needs-__volatile__.patch
Type: text/x-patch
Size: 8084 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20171108/be51c1f9/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20171108/be51c1f9/attachment-0002.bin>


More information about the gmp-bugs mailing list