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



             Bug #: 56361

           Summary: assertion failure passing structs w/o fields by value

                    on sparc64

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: target

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: jay.kr...@cornell.edu





We have a strange front end.

It declares structs with size but no fields.

It actually works..except sometimes for SPARC64.





We have a function that passes a few structs by value.

They are 12 bytes each.







4.7.2/config/sparc/sparc.c:

static rtx

function_arg_record_value (const_tree type, enum machine_mode mode,

               int slotno, int named, int regbase)

.

.

.



      else

    {

      /* ??? C++ has structures with no fields, and yet a size.  Give up

         for now and pass everything back in integer registers.  */

      nregs = (typesize + UNITS_PER_WORD - 1) / UNITS_PER_WORD;

    }

      if (nregs + slotno > SPARC_INT_ARG_MAX)

    nregs = SPARC_INT_ARG_MAX - slotno;

    }

  gcc_assert (nregs != 0);







SPARC_INT_ARG_MAX == 6

nregs = 2

slotno = 6

so then nregs = 0

and the assert fails





I think it should say:

  gcc_assert (nregs != 0 || parms.stack);

Reply via email to