https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69400
--- Comment #12 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- Author: rsandifo Date: Thu May 19 08:38:23 2016 New Revision: 236444 URL: https://gcc.gnu.org/viewcvs?rev=236444&root=gcc&view=rev Log: PR 69400: Invalid 128-bit modulus result Backport from mainline: gcc/ 2016-01-26 Richard Sandiford <richard.sandif...@arm.com> PR tree-optimization/69400 * wide-int.cc (wi_pack): Take the precision as argument and perform canonicalization here rather than in the callers. Use the main loop to handle all full-width HWIs. Add a zero HWI if in_len isn't a full result. (wi::divmod_internal): Update accordingly. (wi::mul_internal): Likewise. Simplify. gcc/testsuite/ 2016-01-26 Richard Sandiford <richard.sandif...@arm.com> PR tree-optimization/69400 * gcc.dg/plugin/wide-int_plugin.c (test_wide_int_mod_trunc): New function. (plugin_init): Call it. * gcc.dg/torture/pr69400.c: New test. Added: branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr69400.c Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/testsuite/ChangeLog branches/gcc-5-branch/gcc/testsuite/gcc.dg/plugin/wide-int_plugin.c branches/gcc-5-branch/gcc/wide-int.cc