This source code, compiled on powerpc-linux with -O1, results in an internal
compiler error since Peter Bergner's change to pass SDmode arguments in
floating point registers:

    extern void bar (_Decimal32);
    _Decimal32 *p;
    void
    foo (void)
    {
      bar (*p);
    }

The error message:

    elm3b145% /opt/gcc-nightly/trunk/bin/gcc -c -O1 bug.c
    bug.c: In function ‘foo’:
    bug.c:8: internal compiler error: in rs6000_secondary_memory_needed_rtx, at
config/rs6000/rs6000.c:11204
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://gcc.gnu.org/bugs.html> for instructions.

It compiles cleanly with "-O1 -fno-tree-ter".

The problem is that TER removes a temporary added to dereference "p" and
instead passes *p directly.  Code in rs6000_check_sdmode, a function Peter
added to determine whether a function needs a stack slot for passing SDmode
arguments, doesn't look for a dereference and so the temporary stack slot isn't
created.

This might fix it, but rather than jumping in and testing it thoroughly I'll
talk to Peter about it when he returns from vacation.

Index: rs6000.c
===================================================================
--- rs6000.c    (revision 133292)
+++ rs6000.c    (working copy)
@@ -11230,6 +11230,7 @@ rs6000_check_sdmode (tree *tp, int *walk
     case FIELD_DECL:
     case RESULT_DECL:
     case REAL_CST:
+    case INDIRECT_REF:
       if (TYPE_MODE (TREE_TYPE (*tp)) == SDmode)
        return *tp;
       break;

This is a regression in GCC 4.3 (where the previous code didn't comply with the
ABI) and on mainline.


-- 
           Summary: ICE passing dereferenced pointer to _Decimal32
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis at gcc dot gnu dot org
GCC target triplet: powerpc-unknown-linux-gnu


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

Reply via email to