This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/18045] New: Wrong code for signed integer remainder


The following testcase:

extern void abort(void);

long long smod16(long long x)
{
  return x % 16;
}

int main(void)
{
  if (smod16 (0xFFFFFFFF) != 0xF)
    abort ();

  return 0;
}

distilled from ada/uintp.adb:UI_From_Dint is miscompiled on i486 because of

2004-06-27  Roger Sayle  <roger@eyesopen.com>

	* expmed.c (expand_smod_pow2): New function to expand signed
	remainder by a constant power of 2, such as "x % 16".
	(expand_divmod): Call new expand_smod_pow2 when appropriate.
	Minor corrections to comments, e.g. splitting long lines.


The second part of expand_smod_pow2 cannot handle modes whose size is greater
than that of HOST_WIDE_INT.

-- 
           Summary: Wrong code for signed integer remainder
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ebotcazou at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-*-*
  GCC host triplet: i486-*-*
GCC target triplet: i486-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18045


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]