This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] ARM half-precision floating point, 2/8 (optabs bug fix)
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 15 Apr 2009 18:19:05 -0400
- Subject: [PATCH] ARM half-precision floating point, 2/8 (optabs bug fix)
This patch fixes a bug I ran into in optabs.c while working on the
half-precision float support. Seeing as though this is a storage
format only, we don't have any arithmetic or comparison optab support
for HFmode, and this code was getting a SEGV by dereferencing a null
pointer.
-Sandra
2009-04-15 Sandra Loosemore <sandra@codesourcery.com>
gcc/
* optabs.c (prepare_float_lib_cmp): Test that the comparison,
swapped, and reversed optabs exist before trying to use them.
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c (revision 146010)
+++ gcc/optabs.c (working copy)
@@ -4370,10 +4370,12 @@ prepare_float_lib_cmp (rtx *px, rtx *py,
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- if ((libfunc = optab_libfunc (code_to_optab[comparison], mode)))
+ if (code_to_optab[comparison]
+ && (libfunc = optab_libfunc (code_to_optab[comparison], mode)))
break;
- if ((libfunc = optab_libfunc (code_to_optab[swapped] , mode)))
+ if (code_to_optab[swapped]
+ && (libfunc = optab_libfunc (code_to_optab[swapped], mode)))
{
rtx tmp;
tmp = x; x = y; y = tmp;
@@ -4381,7 +4383,8 @@ prepare_float_lib_cmp (rtx *px, rtx *py,
break;
}
- if ((libfunc = optab_libfunc (code_to_optab[reversed], mode))
+ if (code_to_optab[reversed]
+ && (libfunc = optab_libfunc (code_to_optab[reversed], mode))
&& FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, reversed))
{
comparison = reversed;