diff mbox

Fix small oddity in gen_int_libfunc

Message ID 4902551.J47Bx707rj@polaris
State New
Headers show

Commit Message

Eric Botcazou Dec. 9, 2013, 5:53 p.m. UTC
Hi,

there is a small oddity in gen_int_libfunc since 2007:

   if (GET_MODE_CLASS (mode) != MODE_INT
       || mode < word_mode || GET_MODE_BITSIZE (mode) > maxsize)
     return;

I don't think that modes are meant to be compared like that, so the attached 
patch replaces the direct comparison with a comparison on GET_MODE_BITSIZE.

Tested on x86/Linux and PowerPC/Linux, OK for the mainline?


2013-12-09  Eric Botcazou  <ebotcazou@adacore.com>

	* optabs.c (gen_int_libfunc): Do not compare modes directly.

Comments

Jeff Law Dec. 9, 2013, 10 p.m. UTC | #1
On 12/09/13 10:53, Eric Botcazou wrote:
> Hi,
>
> there is a small oddity in gen_int_libfunc since 2007:
>
>     if (GET_MODE_CLASS (mode) != MODE_INT
>         || mode < word_mode || GET_MODE_BITSIZE (mode) > maxsize)
>       return;
>
> I don't think that modes are meant to be compared like that, so the attached
> patch replaces the direct comparison with a comparison on GET_MODE_BITSIZE.
>
> Tested on x86/Linux and PowerPC/Linux, OK for the mainline?
>
>
> 2013-12-09  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* optabs.c (gen_int_libfunc): Do not compare modes directly.
OK.
jeff
diff mbox

Patch

Index: optabs.c
===================================================================
--- optabs.c	(revision 205774)
+++ optabs.c	(working copy)
@@ -5506,7 +5506,8 @@  gen_int_libfunc (optab optable, const ch
   if (maxsize < LONG_LONG_TYPE_SIZE)
     maxsize = LONG_LONG_TYPE_SIZE;
   if (GET_MODE_CLASS (mode) != MODE_INT
-      || mode < word_mode || GET_MODE_BITSIZE (mode) > maxsize)
+      || GET_MODE_BITSIZE (mode) < BITS_PER_WORD
+      || GET_MODE_BITSIZE (mode) > maxsize)
     return;
   gen_libfunc (optable, opname, suffix, mode);
 }